@@ -159,7 +159,7 @@ int ccw_device_clear(struct ccw_device *cdev, unsigned long intparm)
159
159
}
160
160
161
161
/**
162
- * ccw_device_start_key () - start a s390 channel program with key
162
+ * ccw_device_start_timeout_key () - start a s390 channel program with timeout and key
163
163
* @cdev: target ccw device
164
164
* @cpa: logical start address of channel program
165
165
* @intparm: user specific interruption parameter; will be presented back to
@@ -170,10 +170,15 @@ int ccw_device_clear(struct ccw_device *cdev, unsigned long intparm)
170
170
* @key: storage key to be used for the I/O
171
171
* @flags: additional flags; defines the action to be performed for I/O
172
172
* processing.
173
+ * @expires: timeout value in jiffies
173
174
*
174
175
* Start a S/390 channel program. When the interrupt arrives, the
175
176
* IRQ handler is called, either immediately, delayed (dev-end missing,
176
177
* or sense required) or never (no IRQ handler registered).
178
+ * This function notifies the device driver if the channel program has not
179
+ * completed during the time specified by @expires. If a timeout occurs, the
180
+ * channel program is terminated via xsch, hsch or csch, and the device's
181
+ * interrupt handler will be called with an irb containing ERR_PTR(-%ETIMEDOUT).
177
182
* Returns:
178
183
* %0, if the operation was successful;
179
184
* -%EBUSY, if the device is busy, or status pending;
@@ -182,9 +187,9 @@ int ccw_device_clear(struct ccw_device *cdev, unsigned long intparm)
182
187
* Context:
183
188
* Interrupts disabled, ccw device lock held
184
189
*/
185
- int ccw_device_start_key (struct ccw_device * cdev , struct ccw1 * cpa ,
186
- unsigned long intparm , __u8 lpm , __u8 key ,
187
- unsigned long flags )
190
+ int ccw_device_start_timeout_key (struct ccw_device * cdev , struct ccw1 * cpa ,
191
+ unsigned long intparm , __u8 lpm , __u8 key ,
192
+ unsigned long flags , int expires )
188
193
{
189
194
struct subchannel * sch ;
190
195
int ret ;
@@ -224,6 +229,8 @@ int ccw_device_start_key(struct ccw_device *cdev, struct ccw1 *cpa,
224
229
switch (ret ) {
225
230
case 0 :
226
231
cdev -> private -> intparm = intparm ;
232
+ if (expires )
233
+ ccw_device_set_timeout (cdev , expires );
227
234
break ;
228
235
case - EACCES :
229
236
case - ENODEV :
@@ -234,7 +241,7 @@ int ccw_device_start_key(struct ccw_device *cdev, struct ccw1 *cpa,
234
241
}
235
242
236
243
/**
237
- * ccw_device_start_timeout_key () - start a s390 channel program with timeout and key
244
+ * ccw_device_start_key () - start a s390 channel program with key
238
245
* @cdev: target ccw device
239
246
* @cpa: logical start address of channel program
240
247
* @intparm: user specific interruption parameter; will be presented back to
@@ -245,15 +252,10 @@ int ccw_device_start_key(struct ccw_device *cdev, struct ccw1 *cpa,
245
252
* @key: storage key to be used for the I/O
246
253
* @flags: additional flags; defines the action to be performed for I/O
247
254
* processing.
248
- * @expires: timeout value in jiffies
249
255
*
250
256
* Start a S/390 channel program. When the interrupt arrives, the
251
257
* IRQ handler is called, either immediately, delayed (dev-end missing,
252
258
* or sense required) or never (no IRQ handler registered).
253
- * This function notifies the device driver if the channel program has not
254
- * completed during the time specified by @expires. If a timeout occurs, the
255
- * channel program is terminated via xsch, hsch or csch, and the device's
256
- * interrupt handler will be called with an irb containing ERR_PTR(-%ETIMEDOUT).
257
259
* Returns:
258
260
* %0, if the operation was successful;
259
261
* -%EBUSY, if the device is busy, or status pending;
@@ -262,19 +264,12 @@ int ccw_device_start_key(struct ccw_device *cdev, struct ccw1 *cpa,
262
264
* Context:
263
265
* Interrupts disabled, ccw device lock held
264
266
*/
265
- int ccw_device_start_timeout_key (struct ccw_device * cdev , struct ccw1 * cpa ,
266
- unsigned long intparm , __u8 lpm , __u8 key ,
267
- unsigned long flags , int expires )
267
+ int ccw_device_start_key (struct ccw_device * cdev , struct ccw1 * cpa ,
268
+ unsigned long intparm , __u8 lpm , __u8 key ,
269
+ unsigned long flags )
268
270
{
269
- int ret ;
270
-
271
- if (!cdev )
272
- return - ENODEV ;
273
- ccw_device_set_timeout (cdev , expires );
274
- ret = ccw_device_start_key (cdev , cpa , intparm , lpm , key , flags );
275
- if (ret != 0 )
276
- ccw_device_set_timeout (cdev , 0 );
277
- return ret ;
271
+ return ccw_device_start_timeout_key (cdev , cpa , intparm , lpm , key ,
272
+ flags , 0 );
278
273
}
279
274
280
275
/**
@@ -489,18 +484,20 @@ void ccw_device_get_id(struct ccw_device *cdev, struct ccw_dev_id *dev_id)
489
484
EXPORT_SYMBOL (ccw_device_get_id );
490
485
491
486
/**
492
- * ccw_device_tm_start_key () - perform start function
487
+ * ccw_device_tm_start_timeout_key () - perform start function
493
488
* @cdev: ccw device on which to perform the start function
494
489
* @tcw: transport-command word to be started
495
490
* @intparm: user defined parameter to be passed to the interrupt handler
496
491
* @lpm: mask of paths to use
497
492
* @key: storage key to use for storage access
493
+ * @expires: time span in jiffies after which to abort request
498
494
*
499
495
* Start the tcw on the given ccw device. Return zero on success, non-zero
500
496
* otherwise.
501
497
*/
502
- int ccw_device_tm_start_key (struct ccw_device * cdev , struct tcw * tcw ,
503
- unsigned long intparm , u8 lpm , u8 key )
498
+ int ccw_device_tm_start_timeout_key (struct ccw_device * cdev , struct tcw * tcw ,
499
+ unsigned long intparm , u8 lpm , u8 key ,
500
+ int expires )
504
501
{
505
502
struct subchannel * sch ;
506
503
int rc ;
@@ -527,37 +524,32 @@ int ccw_device_tm_start_key(struct ccw_device *cdev, struct tcw *tcw,
527
524
return - EACCES ;
528
525
}
529
526
rc = cio_tm_start_key (sch , tcw , lpm , key );
530
- if (rc == 0 )
527
+ if (rc == 0 ) {
531
528
cdev -> private -> intparm = intparm ;
529
+ if (expires )
530
+ ccw_device_set_timeout (cdev , expires );
531
+ }
532
532
return rc ;
533
533
}
534
- EXPORT_SYMBOL (ccw_device_tm_start_key );
534
+ EXPORT_SYMBOL (ccw_device_tm_start_timeout_key );
535
535
536
536
/**
537
- * ccw_device_tm_start_timeout_key () - perform start function
537
+ * ccw_device_tm_start_key () - perform start function
538
538
* @cdev: ccw device on which to perform the start function
539
539
* @tcw: transport-command word to be started
540
540
* @intparm: user defined parameter to be passed to the interrupt handler
541
541
* @lpm: mask of paths to use
542
542
* @key: storage key to use for storage access
543
- * @expires: time span in jiffies after which to abort request
544
543
*
545
544
* Start the tcw on the given ccw device. Return zero on success, non-zero
546
545
* otherwise.
547
546
*/
548
- int ccw_device_tm_start_timeout_key (struct ccw_device * cdev , struct tcw * tcw ,
549
- unsigned long intparm , u8 lpm , u8 key ,
550
- int expires )
547
+ int ccw_device_tm_start_key (struct ccw_device * cdev , struct tcw * tcw ,
548
+ unsigned long intparm , u8 lpm , u8 key )
551
549
{
552
- int ret ;
553
-
554
- ccw_device_set_timeout (cdev , expires );
555
- ret = ccw_device_tm_start_key (cdev , tcw , intparm , lpm , key );
556
- if (ret != 0 )
557
- ccw_device_set_timeout (cdev , 0 );
558
- return ret ;
550
+ return ccw_device_tm_start_timeout_key (cdev , tcw , intparm , lpm , key , 0 );
559
551
}
560
- EXPORT_SYMBOL (ccw_device_tm_start_timeout_key );
552
+ EXPORT_SYMBOL (ccw_device_tm_start_key );
561
553
562
554
/**
563
555
* ccw_device_tm_start() - perform start function
0 commit comments