diff options
author | Cornelia Huck <cornelia.huck@de.ibm.com> | 2006-07-12 10:39:50 -0400 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2006-07-12 10:39:50 -0400 |
commit | 6ab4879a0d074c938fd17dba141dce042fc17bee (patch) | |
tree | 62e413692d4c55ae322c3201c36ded4808806cb5 /drivers/s390/cio/css.c | |
parent | 63f4f9e1281ea9b9a2304bd13d657ba9d401c9a7 (diff) |
[S390] subchannel register/unregister mutex.
Add a reg_mutex to prevent unregistering a subchannel before it has been
registered. Since 2.6.17, we've seen oopses in kslowcrw when a device is
found to be not operational during sense id when doing initial device
recognition; it is not clear yet why that particular problem was not (yet)
observed with earlier kernels...
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/css.c')
-rw-r--r-- | drivers/s390/cio/css.c | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/drivers/s390/cio/css.c b/drivers/s390/cio/css.c index 1d3be80797f8..a09deea5d687 100644 --- a/drivers/s390/cio/css.c +++ b/drivers/s390/cio/css.c | |||
@@ -108,6 +108,24 @@ css_subchannel_release(struct device *dev) | |||
108 | 108 | ||
109 | extern int css_get_ssd_info(struct subchannel *sch); | 109 | extern int css_get_ssd_info(struct subchannel *sch); |
110 | 110 | ||
111 | |||
112 | int css_sch_device_register(struct subchannel *sch) | ||
113 | { | ||
114 | int ret; | ||
115 | |||
116 | mutex_lock(&sch->reg_mutex); | ||
117 | ret = device_register(&sch->dev); | ||
118 | mutex_unlock(&sch->reg_mutex); | ||
119 | return ret; | ||
120 | } | ||
121 | |||
122 | void css_sch_device_unregister(struct subchannel *sch) | ||
123 | { | ||
124 | mutex_lock(&sch->reg_mutex); | ||
125 | device_unregister(&sch->dev); | ||
126 | mutex_unlock(&sch->reg_mutex); | ||
127 | } | ||
128 | |||
111 | static int | 129 | static int |
112 | css_register_subchannel(struct subchannel *sch) | 130 | css_register_subchannel(struct subchannel *sch) |
113 | { | 131 | { |
@@ -119,7 +137,7 @@ css_register_subchannel(struct subchannel *sch) | |||
119 | sch->dev.release = &css_subchannel_release; | 137 | sch->dev.release = &css_subchannel_release; |
120 | 138 | ||
121 | /* make it known to the system */ | 139 | /* make it known to the system */ |
122 | ret = device_register(&sch->dev); | 140 | ret = css_sch_device_register(sch); |
123 | if (ret) | 141 | if (ret) |
124 | printk (KERN_WARNING "%s: could not register %s\n", | 142 | printk (KERN_WARNING "%s: could not register %s\n", |
125 | __func__, sch->dev.bus_id); | 143 | __func__, sch->dev.bus_id); |
@@ -250,7 +268,7 @@ css_evaluate_subchannel(struct subchannel_id schid, int slow) | |||
250 | * The device will be killed automatically. | 268 | * The device will be killed automatically. |
251 | */ | 269 | */ |
252 | cio_disable_subchannel(sch); | 270 | cio_disable_subchannel(sch); |
253 | device_unregister(&sch->dev); | 271 | css_sch_device_unregister(sch); |
254 | /* Reset intparm to zeroes. */ | 272 | /* Reset intparm to zeroes. */ |
255 | sch->schib.pmcw.intparm = 0; | 273 | sch->schib.pmcw.intparm = 0; |
256 | cio_modify(sch); | 274 | cio_modify(sch); |
@@ -264,7 +282,7 @@ css_evaluate_subchannel(struct subchannel_id schid, int slow) | |||
264 | * away in any case. | 282 | * away in any case. |
265 | */ | 283 | */ |
266 | if (!disc) { | 284 | if (!disc) { |
267 | device_unregister(&sch->dev); | 285 | css_sch_device_unregister(sch); |
268 | /* Reset intparm to zeroes. */ | 286 | /* Reset intparm to zeroes. */ |
269 | sch->schib.pmcw.intparm = 0; | 287 | sch->schib.pmcw.intparm = 0; |
270 | cio_modify(sch); | 288 | cio_modify(sch); |