static int cio_validate_msg_subchannel(struct subchannel *sch) { /* Initialization for message subchannels. */ if (!css_sch_is_valid(&sch->schib)) return -ENODEV; /* Devno is valid. */ return cio_check_devno_blacklisted(sch); }
static int cio_validate_msg_subchannel(struct subchannel *sch) { if (!css_sch_is_valid(&sch->schib)) return -ENODEV; return cio_check_devno_blacklisted(sch); }
/** * cio_validate_subchannel - basic validation of subchannel * @sch: subchannel structure to be filled out * @schid: subchannel id * * Find out subchannel type and initialize struct subchannel. * Return codes: * 0 on success * -ENXIO for non-defined subchannels * -ENODEV for invalid subchannels or blacklisted devices * -EIO for subchannels in an invalid subchannel set */ int cio_validate_subchannel(struct subchannel *sch, struct subchannel_id schid) { char dbf_txt[15]; int ccode; int err; sprintf(dbf_txt, "valsch%x", schid.sch_no); CIO_TRACE_EVENT(4, dbf_txt); /* * The first subchannel that is not-operational (ccode==3) * indicates that there aren't any more devices available. * If stsch gets an exception, it means the current subchannel set * is not valid. */ ccode = stsch(schid, &sch->schib); if (ccode) { err = (ccode == 3) ? -ENXIO : ccode; goto out; } sch->st = sch->schib.pmcw.st; sch->schid = schid; switch (sch->st) { case SUBCHANNEL_TYPE_IO: case SUBCHANNEL_TYPE_MSG: if (!css_sch_is_valid(&sch->schib)) err = -ENODEV; else err = cio_check_devno_blacklisted(sch); break; default: err = 0; } if (err) goto out; CIO_MSG_EVENT(4, "Subchannel 0.%x.%04x reports subchannel type %04X\n", sch->schid.ssid, sch->schid.sch_no, sch->st); out: return err; }