aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390
diff options
context:
space:
mode:
authorCornelia Huck <cornelia.huck@de.ibm.com>2008-01-26 08:10:46 -0500
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2008-01-26 08:11:02 -0500
commitdb6a64238a927777e6e7b251927313f186455b1c (patch)
tree1c87902e01b7e0a67b81eb641392cd83717a8970 /drivers/s390
parentb279a4f56d5476a0b9b0a97397f7a7bbe00b9b2f (diff)
[S390] cio: Use dev_{g,s}et_drvdata().
Also define helpers sch_{g,s}et_cdev() to make the intention more clear. Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'drivers/s390')
-rw-r--r--drivers/s390/cio/ccwgroup.c14
-rw-r--r--drivers/s390/cio/device.c36
-rw-r--r--drivers/s390/cio/device_fsm.c26
-rw-r--r--drivers/s390/cio/io_sch.h2
4 files changed, 40 insertions, 38 deletions
diff --git a/drivers/s390/cio/ccwgroup.c b/drivers/s390/cio/ccwgroup.c
index b3e2c16caa41..b9997fb4883c 100644
--- a/drivers/s390/cio/ccwgroup.c
+++ b/drivers/s390/cio/ccwgroup.c
@@ -111,7 +111,7 @@ ccwgroup_release (struct device *dev)
111 gdev = to_ccwgroupdev(dev); 111 gdev = to_ccwgroupdev(dev);
112 112
113 for (i = 0; i < gdev->count; i++) { 113 for (i = 0; i < gdev->count; i++) {
114 gdev->cdev[i]->dev.driver_data = NULL; 114 dev_set_drvdata(&gdev->cdev[i]->dev, NULL);
115 put_device(&gdev->cdev[i]->dev); 115 put_device(&gdev->cdev[i]->dev);
116 } 116 }
117 kfree(gdev); 117 kfree(gdev);
@@ -196,11 +196,11 @@ int ccwgroup_create(struct device *root, unsigned int creator_id,
196 goto error; 196 goto error;
197 } 197 }
198 /* Don't allow a device to belong to more than one group. */ 198 /* Don't allow a device to belong to more than one group. */
199 if (gdev->cdev[i]->dev.driver_data) { 199 if (dev_get_drvdata(&gdev->cdev[i]->dev)) {
200 rc = -EINVAL; 200 rc = -EINVAL;
201 goto error; 201 goto error;
202 } 202 }
203 gdev->cdev[i]->dev.driver_data = gdev; 203 dev_set_drvdata(&gdev->cdev[i]->dev, gdev);
204 } 204 }
205 205
206 gdev->creator_id = creator_id; 206 gdev->creator_id = creator_id;
@@ -234,8 +234,8 @@ int ccwgroup_create(struct device *root, unsigned int creator_id,
234error: 234error:
235 for (i = 0; i < argc; i++) 235 for (i = 0; i < argc; i++)
236 if (gdev->cdev[i]) { 236 if (gdev->cdev[i]) {
237 if (gdev->cdev[i]->dev.driver_data == gdev) 237 if (dev_get_drvdata(&gdev->cdev[i]->dev) == gdev)
238 gdev->cdev[i]->dev.driver_data = NULL; 238 dev_set_drvdata(&gdev->cdev[i]->dev, NULL);
239 put_device(&gdev->cdev[i]->dev); 239 put_device(&gdev->cdev[i]->dev);
240 } 240 }
241 mutex_unlock(&gdev->reg_mutex); 241 mutex_unlock(&gdev->reg_mutex);
@@ -463,8 +463,8 @@ __ccwgroup_get_gdev_by_cdev(struct ccw_device *cdev)
463{ 463{
464 struct ccwgroup_device *gdev; 464 struct ccwgroup_device *gdev;
465 465
466 if (cdev->dev.driver_data) { 466 gdev = dev_get_drvdata(&cdev->dev);
467 gdev = (struct ccwgroup_device *)cdev->dev.driver_data; 467 if (gdev) {
468 if (get_device(&gdev->dev)) { 468 if (get_device(&gdev->dev)) {
469 mutex_lock(&gdev->reg_mutex); 469 mutex_lock(&gdev->reg_mutex);
470 if (device_is_registered(&gdev->dev)) 470 if (device_is_registered(&gdev->dev))
diff --git a/drivers/s390/cio/device.c b/drivers/s390/cio/device.c
index 30fe59cc28c9..933f763e9586 100644
--- a/drivers/s390/cio/device.c
+++ b/drivers/s390/cio/device.c
@@ -773,7 +773,7 @@ static void sch_attach_device(struct subchannel *sch,
773{ 773{
774 css_update_ssd_info(sch); 774 css_update_ssd_info(sch);
775 spin_lock_irq(sch->lock); 775 spin_lock_irq(sch->lock);
776 sch->dev.driver_data = cdev; 776 sch_set_cdev(sch, cdev);
777 cdev->private->schid = sch->schid; 777 cdev->private->schid = sch->schid;
778 cdev->ccwlock = sch->lock; 778 cdev->ccwlock = sch->lock;
779 device_trigger_reprobe(sch); 779 device_trigger_reprobe(sch);
@@ -795,7 +795,7 @@ static void sch_attach_disconnected_device(struct subchannel *sch,
795 put_device(&other_sch->dev); 795 put_device(&other_sch->dev);
796 return; 796 return;
797 } 797 }
798 other_sch->dev.driver_data = NULL; 798 sch_set_cdev(other_sch, NULL);
799 /* No need to keep a subchannel without ccw device around. */ 799 /* No need to keep a subchannel without ccw device around. */
800 css_sch_device_unregister(other_sch); 800 css_sch_device_unregister(other_sch);
801 put_device(&other_sch->dev); 801 put_device(&other_sch->dev);
@@ -831,12 +831,12 @@ static void sch_create_and_recog_new_device(struct subchannel *sch)
831 return; 831 return;
832 } 832 }
833 spin_lock_irq(sch->lock); 833 spin_lock_irq(sch->lock);
834 sch->dev.driver_data = cdev; 834 sch_set_cdev(sch, cdev);
835 spin_unlock_irq(sch->lock); 835 spin_unlock_irq(sch->lock);
836 /* Start recognition for the new ccw device. */ 836 /* Start recognition for the new ccw device. */
837 if (io_subchannel_recog(cdev, sch)) { 837 if (io_subchannel_recog(cdev, sch)) {
838 spin_lock_irq(sch->lock); 838 spin_lock_irq(sch->lock);
839 sch->dev.driver_data = NULL; 839 sch_set_cdev(sch, NULL);
840 spin_unlock_irq(sch->lock); 840 spin_unlock_irq(sch->lock);
841 if (cdev->dev.release) 841 if (cdev->dev.release)
842 cdev->dev.release(&cdev->dev); 842 cdev->dev.release(&cdev->dev);
@@ -940,7 +940,7 @@ io_subchannel_register(struct work_struct *work)
940 cdev->private->dev_id.devno, ret); 940 cdev->private->dev_id.devno, ret);
941 put_device(&cdev->dev); 941 put_device(&cdev->dev);
942 spin_lock_irqsave(sch->lock, flags); 942 spin_lock_irqsave(sch->lock, flags);
943 sch->dev.driver_data = NULL; 943 sch_set_cdev(sch, NULL);
944 spin_unlock_irqrestore(sch->lock, flags); 944 spin_unlock_irqrestore(sch->lock, flags);
945 kfree (cdev->private); 945 kfree (cdev->private);
946 kfree (cdev); 946 kfree (cdev);
@@ -1022,7 +1022,7 @@ io_subchannel_recog(struct ccw_device *cdev, struct subchannel *sch)
1022 int rc; 1022 int rc;
1023 struct ccw_device_private *priv; 1023 struct ccw_device_private *priv;
1024 1024
1025 sch->dev.driver_data = cdev; 1025 sch_set_cdev(sch, cdev);
1026 sch->driver = &io_subchannel_driver; 1026 sch->driver = &io_subchannel_driver;
1027 cdev->ccwlock = sch->lock; 1027 cdev->ccwlock = sch->lock;
1028 1028
@@ -1082,7 +1082,7 @@ static void ccw_device_move_to_sch(struct work_struct *work)
1082 } 1082 }
1083 if (former_parent) { 1083 if (former_parent) {
1084 spin_lock_irq(former_parent->lock); 1084 spin_lock_irq(former_parent->lock);
1085 former_parent->dev.driver_data = NULL; 1085 sch_set_cdev(former_parent, NULL);
1086 spin_unlock_irq(former_parent->lock); 1086 spin_unlock_irq(former_parent->lock);
1087 css_sch_device_unregister(former_parent); 1087 css_sch_device_unregister(former_parent);
1088 /* Reset intparm to zeroes. */ 1088 /* Reset intparm to zeroes. */
@@ -1100,7 +1100,7 @@ static void io_subchannel_irq(struct subchannel *sch)
1100{ 1100{
1101 struct ccw_device *cdev; 1101 struct ccw_device *cdev;
1102 1102
1103 cdev = sch->dev.driver_data; 1103 cdev = sch_get_cdev(sch);
1104 1104
1105 CIO_TRACE_EVENT(3, "IRQ"); 1105 CIO_TRACE_EVENT(3, "IRQ");
1106 CIO_TRACE_EVENT(3, sch->dev.bus_id); 1106 CIO_TRACE_EVENT(3, sch->dev.bus_id);
@@ -1116,13 +1116,13 @@ io_subchannel_probe (struct subchannel *sch)
1116 unsigned long flags; 1116 unsigned long flags;
1117 struct ccw_dev_id dev_id; 1117 struct ccw_dev_id dev_id;
1118 1118
1119 if (sch->dev.driver_data) { 1119 cdev = sch_get_cdev(sch);
1120 if (cdev) {
1120 /* 1121 /*
1121 * This subchannel already has an associated ccw_device. 1122 * This subchannel already has an associated ccw_device.
1122 * Register it and exit. This happens for all early 1123 * Register it and exit. This happens for all early
1123 * device, e.g. the console. 1124 * device, e.g. the console.
1124 */ 1125 */
1125 cdev = sch->dev.driver_data;
1126 cdev->dev.groups = ccwdev_attr_groups; 1126 cdev->dev.groups = ccwdev_attr_groups;
1127 device_initialize(&cdev->dev); 1127 device_initialize(&cdev->dev);
1128 ccw_device_register(cdev); 1128 ccw_device_register(cdev);
@@ -1173,7 +1173,7 @@ io_subchannel_probe (struct subchannel *sch)
1173 rc = io_subchannel_recog(cdev, sch); 1173 rc = io_subchannel_recog(cdev, sch);
1174 if (rc) { 1174 if (rc) {
1175 spin_lock_irqsave(sch->lock, flags); 1175 spin_lock_irqsave(sch->lock, flags);
1176 sch->dev.driver_data = NULL; 1176 sch_set_cdev(sch, NULL);
1177 spin_unlock_irqrestore(sch->lock, flags); 1177 spin_unlock_irqrestore(sch->lock, flags);
1178 if (cdev->dev.release) 1178 if (cdev->dev.release)
1179 cdev->dev.release(&cdev->dev); 1179 cdev->dev.release(&cdev->dev);
@@ -1189,12 +1189,12 @@ io_subchannel_remove (struct subchannel *sch)
1189 struct ccw_device *cdev; 1189 struct ccw_device *cdev;
1190 unsigned long flags; 1190 unsigned long flags;
1191 1191
1192 if (!sch->dev.driver_data) 1192 cdev = sch_get_cdev(sch);
1193 if (!cdev)
1193 return 0; 1194 return 0;
1194 cdev = sch->dev.driver_data;
1195 /* Set ccw device to not operational and drop reference. */ 1195 /* Set ccw device to not operational and drop reference. */
1196 spin_lock_irqsave(cdev->ccwlock, flags); 1196 spin_lock_irqsave(cdev->ccwlock, flags);
1197 sch->dev.driver_data = NULL; 1197 sch_set_cdev(sch, NULL);
1198 cdev->private->state = DEV_STATE_NOT_OPER; 1198 cdev->private->state = DEV_STATE_NOT_OPER;
1199 spin_unlock_irqrestore(cdev->ccwlock, flags); 1199 spin_unlock_irqrestore(cdev->ccwlock, flags);
1200 ccw_device_unregister(cdev); 1200 ccw_device_unregister(cdev);
@@ -1207,7 +1207,7 @@ static int io_subchannel_notify(struct subchannel *sch, int event)
1207{ 1207{
1208 struct ccw_device *cdev; 1208 struct ccw_device *cdev;
1209 1209
1210 cdev = sch->dev.driver_data; 1210 cdev = sch_get_cdev(sch);
1211 if (!cdev) 1211 if (!cdev)
1212 return 0; 1212 return 0;
1213 if (!cdev->drv) 1213 if (!cdev->drv)
@@ -1221,7 +1221,7 @@ static void io_subchannel_verify(struct subchannel *sch)
1221{ 1221{
1222 struct ccw_device *cdev; 1222 struct ccw_device *cdev;
1223 1223
1224 cdev = sch->dev.driver_data; 1224 cdev = sch_get_cdev(sch);
1225 if (cdev) 1225 if (cdev)
1226 dev_fsm_event(cdev, DEV_EVENT_VERIFY); 1226 dev_fsm_event(cdev, DEV_EVENT_VERIFY);
1227} 1227}
@@ -1230,7 +1230,7 @@ static void io_subchannel_ioterm(struct subchannel *sch)
1230{ 1230{
1231 struct ccw_device *cdev; 1231 struct ccw_device *cdev;
1232 1232
1233 cdev = sch->dev.driver_data; 1233 cdev = sch_get_cdev(sch);
1234 if (!cdev) 1234 if (!cdev)
1235 return; 1235 return;
1236 /* Internal I/O will be retried by the interrupt handler. */ 1236 /* Internal I/O will be retried by the interrupt handler. */
@@ -1248,7 +1248,7 @@ io_subchannel_shutdown(struct subchannel *sch)
1248 struct ccw_device *cdev; 1248 struct ccw_device *cdev;
1249 int ret; 1249 int ret;
1250 1250
1251 cdev = sch->dev.driver_data; 1251 cdev = sch_get_cdev(sch);
1252 1252
1253 if (cio_is_console(sch->schid)) 1253 if (cio_is_console(sch->schid))
1254 return; 1254 return;
diff --git a/drivers/s390/cio/device_fsm.c b/drivers/s390/cio/device_fsm.c
index 4804d944fb4d..669e6a75f54f 100644
--- a/drivers/s390/cio/device_fsm.c
+++ b/drivers/s390/cio/device_fsm.c
@@ -32,9 +32,9 @@ device_is_online(struct subchannel *sch)
32{ 32{
33 struct ccw_device *cdev; 33 struct ccw_device *cdev;
34 34
35 if (!sch->dev.driver_data) 35 cdev = sch_get_cdev(sch);
36 if (!cdev)
36 return 0; 37 return 0;
37 cdev = sch->dev.driver_data;
38 return (cdev->private->state == DEV_STATE_ONLINE); 38 return (cdev->private->state == DEV_STATE_ONLINE);
39} 39}
40 40
@@ -43,9 +43,9 @@ device_is_disconnected(struct subchannel *sch)
43{ 43{
44 struct ccw_device *cdev; 44 struct ccw_device *cdev;
45 45
46 if (!sch->dev.driver_data) 46 cdev = sch_get_cdev(sch);
47 if (!cdev)
47 return 0; 48 return 0;
48 cdev = sch->dev.driver_data;
49 return (cdev->private->state == DEV_STATE_DISCONNECTED || 49 return (cdev->private->state == DEV_STATE_DISCONNECTED ||
50 cdev->private->state == DEV_STATE_DISCONNECTED_SENSE_ID); 50 cdev->private->state == DEV_STATE_DISCONNECTED_SENSE_ID);
51} 51}
@@ -55,9 +55,9 @@ device_set_disconnected(struct subchannel *sch)
55{ 55{
56 struct ccw_device *cdev; 56 struct ccw_device *cdev;
57 57
58 if (!sch->dev.driver_data) 58 cdev = sch_get_cdev(sch);
59 if (!cdev)
59 return; 60 return;
60 cdev = sch->dev.driver_data;
61 ccw_device_set_timeout(cdev, 0); 61 ccw_device_set_timeout(cdev, 0);
62 cdev->private->flags.fake_irb = 0; 62 cdev->private->flags.fake_irb = 0;
63 cdev->private->state = DEV_STATE_DISCONNECTED; 63 cdev->private->state = DEV_STATE_DISCONNECTED;
@@ -67,7 +67,7 @@ void device_set_intretry(struct subchannel *sch)
67{ 67{
68 struct ccw_device *cdev; 68 struct ccw_device *cdev;
69 69
70 cdev = sch->dev.driver_data; 70 cdev = sch_get_cdev(sch);
71 if (!cdev) 71 if (!cdev)
72 return; 72 return;
73 cdev->private->flags.intretry = 1; 73 cdev->private->flags.intretry = 1;
@@ -77,7 +77,7 @@ int device_trigger_verify(struct subchannel *sch)
77{ 77{
78 struct ccw_device *cdev; 78 struct ccw_device *cdev;
79 79
80 cdev = sch->dev.driver_data; 80 cdev = sch_get_cdev(sch);
81 if (!cdev || !cdev->online) 81 if (!cdev || !cdev->online)
82 return -EINVAL; 82 return -EINVAL;
83 dev_fsm_event(cdev, DEV_EVENT_VERIFY); 83 dev_fsm_event(cdev, DEV_EVENT_VERIFY);
@@ -175,9 +175,9 @@ device_kill_pending_timer(struct subchannel *sch)
175{ 175{
176 struct ccw_device *cdev; 176 struct ccw_device *cdev;
177 177
178 if (!sch->dev.driver_data) 178 cdev = sch_get_cdev(sch);
179 if (!cdev)
179 return; 180 return;
180 cdev = sch->dev.driver_data;
181 ccw_device_set_timeout(cdev, 0); 181 ccw_device_set_timeout(cdev, 0);
182} 182}
183 183
@@ -992,7 +992,7 @@ void device_kill_io(struct subchannel *sch)
992 int ret; 992 int ret;
993 struct ccw_device *cdev; 993 struct ccw_device *cdev;
994 994
995 cdev = sch->dev.driver_data; 995 cdev = sch_get_cdev(sch);
996 ret = ccw_device_cancel_halt_clear(cdev); 996 ret = ccw_device_cancel_halt_clear(cdev);
997 if (ret == -EBUSY) { 997 if (ret == -EBUSY) {
998 ccw_device_set_timeout(cdev, 3*HZ); 998 ccw_device_set_timeout(cdev, 3*HZ);
@@ -1062,9 +1062,9 @@ device_trigger_reprobe(struct subchannel *sch)
1062{ 1062{
1063 struct ccw_device *cdev; 1063 struct ccw_device *cdev;
1064 1064
1065 if (!sch->dev.driver_data) 1065 cdev = sch_get_cdev(sch);
1066 if (!cdev)
1066 return; 1067 return;
1067 cdev = sch->dev.driver_data;
1068 if (cdev->private->state != DEV_STATE_DISCONNECTED) 1068 if (cdev->private->state != DEV_STATE_DISCONNECTED)
1069 return; 1069 return;
1070 1070
diff --git a/drivers/s390/cio/io_sch.h b/drivers/s390/cio/io_sch.h
index d49e5a77a6bf..8c613160bfce 100644
--- a/drivers/s390/cio/io_sch.h
+++ b/drivers/s390/cio/io_sch.h
@@ -34,6 +34,8 @@ struct io_subchannel_private {
34} __attribute__ ((aligned(8))); 34} __attribute__ ((aligned(8)));
35 35
36#define to_io_private(n) ((struct io_subchannel_private *)n->private) 36#define to_io_private(n) ((struct io_subchannel_private *)n->private)
37#define sch_get_cdev(n) (dev_get_drvdata(&n->dev))
38#define sch_set_cdev(n, c) (dev_set_drvdata(&n->dev, c))
37 39
38#define MAX_CIWS 8 40#define MAX_CIWS 8
39 41