/** @brief function for the @b send method in a link_device instance @param ld the pointer to a link_device instance @param iod the pointer to an io_device instance @param skb the pointer to an skb that will be transmitted @retval "> 0" the length of data transmitted if there is NO ERROR @retval "< 0" an error code */ static int mem_send(struct link_device *ld, struct io_device *iod, struct sk_buff *skb) { struct mem_link_device *mld = to_mem_link_device(ld); struct modem_ctl *mc = ld->mc; enum dev_format id = iod->format; u8 ch = iod->id; switch (id) { case IPC_FMT: case IPC_RAW: case IPC_RFS: if (likely(sipc5_ipc_ch(ch))) { if (unlikely(!ipc_active(mld))) return -EIO; if (iod->sbd_ipc) { if (likely(sbd_active(&mld->sbd_link_dev))) return xmit_ipc_to_rb(mld, ch, skb); else return -ENODEV; } else { BUG_ON(1); } } else { return xmit_udl(mld, iod, ch, skb); } break; case IPC_BOOT: case IPC_DUMP: if (sipc5_udl_ch(ch)) return xmit_udl(mld, iod, ch, skb); break; default: break; } mif_err("%s:%s->%s: ERR! Invalid IO device (format:%s id:%d)\n", ld->name, iod->name, mc->name, dev_str(id), ch); return -ENODEV; }
static int xmit_ipc(struct mem_link_device *mld, struct io_device *iod, enum sipc_ch_id ch, struct sk_buff *skb) { if (unlikely(!ipc_active(mld))) return -EIO; #ifdef CONFIG_LINK_DEVICE_WITH_SBD_ARCH if (iod->sbd_ipc) { if (likely(sbd_active(&mld->sbd_link_dev))) return xmit_ipc_to_rb(mld, ch, skb); else return -ENODEV; } else { return xmit_ipc_to_dev(mld, ch, skb); } #else return xmit_ipc_to_dev(mld, ch, skb); #endif }