aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPierre Morel <pmorel@linux.vnet.ibm.com>2015-10-26 06:13:18 -0400
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2015-11-03 08:40:50 -0500
commite510f681d27d402d74dc7b81e13db118e4180937 (patch)
tree696e10adb00c80651acf5ca890e6af8601e0f678
parent8f0ba83178d4f3630687296c45d593326ec2d63d (diff)
s390/cio: de-duplicate subchannel validation
cio_validate_io_subchannel() and cio_validate_msg_subchannel() are identical, as the called functions already take care about the differences between subchannel types. Just inline the code into the only user, cio_validate_subchannel(), instead. Signed-off-by: Pierre Morel <pmorel@linux.vnet.ibm.com> Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com> Acked-by: Sebastian Ott <sebott@linux.vnet.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
-rw-r--r--drivers/s390/cio/cio.c27
1 files changed, 4 insertions, 23 deletions
diff --git a/drivers/s390/cio/cio.c b/drivers/s390/cio/cio.c
index 0cc65b229a9c..b5620e818d6b 100644
--- a/drivers/s390/cio/cio.c
+++ b/drivers/s390/cio/cio.c
@@ -476,26 +476,6 @@ static int cio_check_devno_blacklisted(struct subchannel *sch)
476 return 0; 476 return 0;
477} 477}
478 478
479static int cio_validate_io_subchannel(struct subchannel *sch)
480{
481 /* Initialization for io subchannels. */
482 if (!css_sch_is_valid(&sch->schib))
483 return -ENODEV;
484
485 /* Devno is valid. */
486 return cio_check_devno_blacklisted(sch);
487}
488
489static int cio_validate_msg_subchannel(struct subchannel *sch)
490{
491 /* Initialization for message subchannels. */
492 if (!css_sch_is_valid(&sch->schib))
493 return -ENODEV;
494
495 /* Devno is valid. */
496 return cio_check_devno_blacklisted(sch);
497}
498
499/** 479/**
500 * cio_validate_subchannel - basic validation of subchannel 480 * cio_validate_subchannel - basic validation of subchannel
501 * @sch: subchannel structure to be filled out 481 * @sch: subchannel structure to be filled out
@@ -533,10 +513,11 @@ int cio_validate_subchannel(struct subchannel *sch, struct subchannel_id schid)
533 513
534 switch (sch->st) { 514 switch (sch->st) {
535 case SUBCHANNEL_TYPE_IO: 515 case SUBCHANNEL_TYPE_IO:
536 err = cio_validate_io_subchannel(sch);
537 break;
538 case SUBCHANNEL_TYPE_MSG: 516 case SUBCHANNEL_TYPE_MSG:
539 err = cio_validate_msg_subchannel(sch); 517 if (!css_sch_is_valid(&sch->schib))
518 err = -ENODEV;
519 else
520 err = cio_check_devno_blacklisted(sch);
540 break; 521 break;
541 default: 522 default:
542 err = 0; 523 err = 0;