diff --git a/drivers/media/dvb-core/dvb_frontend.c b/drivers/media/dvb-core/dvb_frontend.c index 0286da57f..f4b599a1a 100644 --- a/drivers/media/dvb-core/dvb_frontend.c +++ b/drivers/media/dvb-core/dvb_frontend.c @@ -1342,13 +1342,19 @@ static int dtv_get_frontend(struct dvb_frontend *fe, static int dvb_frontend_handle_ioctl(struct file *file, unsigned int cmd, void *parg); +enum dtv_get_shape { + SHAPE_DATA, + SHAPE_ST, + SHAPE_BUFFER, +}; + static int dtv_property_process_get(struct dvb_frontend *fe, const struct dtv_frontend_properties *c, struct dtv_property *tvp, struct file *file) { + enum dtv_get_shape shape = SHAPE_DATA; int ncaps; - unsigned int len = 1; switch (tvp->cmd) { case DTV_ENUM_DELSYS: @@ -1358,7 +1364,7 @@ static int dtv_property_process_get(struct dvb_frontend *fe, ncaps++; } tvp->u.buffer.len = ncaps; - len = ncaps; + shape = SHAPE_BUFFER; break; case DTV_FREQUENCY: tvp->u.data = c->frequency; @@ -1536,51 +1542,35 @@ static int dtv_property_process_get(struct dvb_frontend *fe, /* Fill quality measures */ case DTV_STAT_SIGNAL_STRENGTH: tvp->u.st = c->strength; - if (tvp->u.buffer.len > MAX_DTV_STATS * sizeof(u32)) - tvp->u.buffer.len = MAX_DTV_STATS * sizeof(u32); - len = tvp->u.buffer.len; + shape = SHAPE_ST; break; case DTV_STAT_CNR: tvp->u.st = c->cnr; - if (tvp->u.buffer.len > MAX_DTV_STATS * sizeof(u32)) - tvp->u.buffer.len = MAX_DTV_STATS * sizeof(u32); - len = tvp->u.buffer.len; + shape = SHAPE_ST; break; case DTV_STAT_PRE_ERROR_BIT_COUNT: tvp->u.st = c->pre_bit_error; - if (tvp->u.buffer.len > MAX_DTV_STATS * sizeof(u32)) - tvp->u.buffer.len = MAX_DTV_STATS * sizeof(u32); - len = tvp->u.buffer.len; + shape = SHAPE_ST; break; case DTV_STAT_PRE_TOTAL_BIT_COUNT: tvp->u.st = c->pre_bit_count; - if (tvp->u.buffer.len > MAX_DTV_STATS * sizeof(u32)) - tvp->u.buffer.len = MAX_DTV_STATS * sizeof(u32); - len = tvp->u.buffer.len; + shape = SHAPE_ST; break; case DTV_STAT_POST_ERROR_BIT_COUNT: tvp->u.st = c->post_bit_error; - if (tvp->u.buffer.len > MAX_DTV_STATS * sizeof(u32)) - tvp->u.buffer.len = MAX_DTV_STATS * sizeof(u32); - len = tvp->u.buffer.len; + shape = SHAPE_ST; break; case DTV_STAT_POST_TOTAL_BIT_COUNT: tvp->u.st = c->post_bit_count; - if (tvp->u.buffer.len > MAX_DTV_STATS * sizeof(u32)) - tvp->u.buffer.len = MAX_DTV_STATS * sizeof(u32); - len = tvp->u.buffer.len; + shape = SHAPE_ST; break; case DTV_STAT_ERROR_BLOCK_COUNT: tvp->u.st = c->block_error; - if (tvp->u.buffer.len > MAX_DTV_STATS * sizeof(u32)) - tvp->u.buffer.len = MAX_DTV_STATS * sizeof(u32); - len = tvp->u.buffer.len; + shape = SHAPE_ST; break; case DTV_STAT_TOTAL_BLOCK_COUNT: tvp->u.st = c->block_count; - if (tvp->u.buffer.len > MAX_DTV_STATS * sizeof(u32)) - tvp->u.buffer.len = MAX_DTV_STATS * sizeof(u32); - len = tvp->u.buffer.len; + shape = SHAPE_ST; break; default: dev_dbg(fe->dvb->device, @@ -1588,15 +1578,28 @@ static int dtv_property_process_get(struct dvb_frontend *fe, __func__, tvp->cmd); return -EINVAL; } - - if (len < 1) - len = 1; - - dev_dbg(fe->dvb->device, - "%s: GET cmd 0x%08x (%s) len %d: %*ph\n", - __func__, tvp->cmd, dtv_cmd_name(tvp->cmd), - tvp->u.buffer.len, tvp->u.buffer.len, tvp->u.buffer.data); - + switch (shape) { + case SHAPE_BUFFER: + dev_dbg(fe->dvb->device, + "%s: GET cmd 0x%08x (%s) len %d: %*ph\n", + __func__, tvp->cmd, dtv_cmd_name(tvp->cmd), + tvp->u.buffer.len, tvp->u.buffer.len, + tvp->u.buffer.data); + break; + case SHAPE_ST: + dev_dbg(fe->dvb->device, + "%s: GET cmd 0x%08x (%s) len %d: %*ph\n", + __func__, tvp->cmd, dtv_cmd_name(tvp->cmd), + tvp->u.st.len, (int)sizeof(tvp->u.st), + &tvp->u.st); + break; + case SHAPE_DATA: + dev_dbg(fe->dvb->device, + "%s: GET cmd 0x%08x (%s) = 0x%08x\n", + __func__, tvp->cmd, dtv_cmd_name(tvp->cmd), + tvp->u.data); + break; + } return 0; }