static ssize_t fm_ops_read(struct file *filp, char *buf, size_t len, loff_t *off)
{
	struct fm *fm = filp->private_data;
	fm_s32 copy_len = 0;

	if (!fm) {
		WCN_DBG(FM_ALT | MAIN, "fm_read invalid fm pointer\n");
		return 0;
	}

	WCN_DBG(FM_DBG | MAIN, "rds buf len=%zu\n", len);
	WCN_DBG(FM_DBG | MAIN, "sizeof(rds_t)=%zu\n", sizeof(rds_t));

	if (!buf || len < sizeof(rds_t)) {
		WCN_DBG(FM_DBG | MAIN, "fm_read invliad buf\n");
		return 0;
	}
	/* return if FM is resetting */
    if (fm_sys_state_get(fm) != FM_SUBSYS_RST_OFF) {
        WCN_DBG(FM_ALT | MAIN, "fm subsys underring reset\n");
        return 0;
    }

	copy_len = sizeof(rds_t);

	return fm_rds_read(fm, buf, copy_len);
}
Example #2
0
static ssize_t fm_ops_read(struct file *filp, char *buf, size_t len, loff_t *off)
{
    struct fm *fm = filp->private_data;
    fm_s32 copy_len = 0;

    if (!fm) {
        WCN_DBG(FM_ALT | MAIN, "fm_read invalid fm pointer\n");
        return 0;
    }

    if (!buf || len < sizeof(rds_t)) {
        WCN_DBG(FM_DBG | MAIN, "fm_read invliad buf\n");
        return 0;
    }

    //block when FM is resetting
    while (fm_sys_state_get(fm) != FM_SUBSYS_RST_OFF) {
        msleep_interruptible(100);
    }

    copy_len = sizeof(rds_t);

    return fm_rds_read(fm, buf, copy_len);
}