/* ch : The channel, the error belongs to. Returns the error code (!= 0) to inspect.  */
void ctcm_ccw_check_rc(struct channel *ch, int rc, char *msg)
/* ch : The channel, the error belongs to. Returns the error code (!= 0) to inspect.  */
void ctcm_ccw_check_rc(struct channel *ch, int rc, char *msg)
{
	CTCM_DBF_TEXT_(ERROR, CTC_DBF_ERROR,
		"%s(%s): %s: %04x\n",
		CTCM_FUNTAIL, ch->id, msg, rc);
	switch (rc) {
	case -EBUSY:
		pr_info("%s: The communication peer is busy\n",
			ch->id);
		fsm_event(ch->fsm, CTC_EVENT_IO_EBUSY, ch);
		break;
	case -ENODEV:
		pr_err("%s: The specified target device is not valid\n",
		       ch->id);
		fsm_event(ch->fsm, CTC_EVENT_IO_ENODEV, ch);
		break;
	default:
		pr_err("An I/O operation resulted in error %04x\n",
		       rc);
		fsm_event(ch->fsm, CTC_EVENT_IO_UNKNOWN, ch);
	}
}