Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1497404
| From | Mauro Carvalho Chehab <mchehab@s-opensource.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 04/26] cinergyT2-fe: cache stats at cinergyt2_fe_read_status() |
| Date | 2016-10-07 19:30 +0200 |
| Message-ID | <spH86-3EG-45@gated-at.bofh.it> (permalink) |
| References | <spH85-3EG-5@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Instead of sending USB commands for every stats call, collect
them once, when status is updated. As the frontend kthread
will call it on every few seconds, the stats will still be
collected.
Besides reducing the amount of USB/I2C transfers, this also
warrants that all stats will be collected at the same time,
and makes easier to convert it to DVBv5 stats in the future.
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
---
drivers/media/usb/dvb-usb/cinergyT2-fe.c | 48 +++++---------------------------
1 file changed, 7 insertions(+), 41 deletions(-)
diff --git a/drivers/media/usb/dvb-usb/cinergyT2-fe.c b/drivers/media/usb/dvb-usb/cinergyT2-fe.c
index b3ec743a7a2e..fd8edcb56e61 100644
--- a/drivers/media/usb/dvb-usb/cinergyT2-fe.c
+++ b/drivers/media/usb/dvb-usb/cinergyT2-fe.c
@@ -139,6 +139,7 @@ static uint16_t compute_tps(struct dtv_frontend_properties *op)
struct cinergyt2_fe_state {
struct dvb_frontend fe;
struct dvb_usb_device *d;
+ struct dvbt_get_status_msg status;
};
static int cinergyt2_fe_read_status(struct dvb_frontend *fe,
@@ -154,6 +155,8 @@ static int cinergyt2_fe_read_status(struct dvb_frontend *fe,
if (ret < 0)
return ret;
+ state->status = result;
+
*status = 0;
if (0xffff - le16_to_cpu(result.gain) > 30)
@@ -177,34 +180,16 @@ static int cinergyt2_fe_read_status(struct dvb_frontend *fe,
static int cinergyt2_fe_read_ber(struct dvb_frontend *fe, u32 *ber)
{
struct cinergyt2_fe_state *state = fe->demodulator_priv;
- struct dvbt_get_status_msg status;
- char cmd[] = { CINERGYT2_EP1_GET_TUNER_STATUS };
- int ret;
- ret = dvb_usb_generic_rw(state->d, cmd, sizeof(cmd), (char *)&status,
- sizeof(status), 0);
- if (ret < 0)
- return ret;
-
- *ber = le32_to_cpu(status.viterbi_error_rate);
+ *ber = le32_to_cpu(state->status.viterbi_error_rate);
return 0;
}
static int cinergyt2_fe_read_unc_blocks(struct dvb_frontend *fe, u32 *unc)
{
struct cinergyt2_fe_state *state = fe->demodulator_priv;
- struct dvbt_get_status_msg status;
- u8 cmd[] = { CINERGYT2_EP1_GET_TUNER_STATUS };
- int ret;
- ret = dvb_usb_generic_rw(state->d, cmd, sizeof(cmd), (u8 *)&status,
- sizeof(status), 0);
- if (ret < 0) {
- err("cinergyt2_fe_read_unc_blocks() Failed! (Error=%d)\n",
- ret);
- return ret;
- }
- *unc = le32_to_cpu(status.uncorrected_block_count);
+ *unc = le32_to_cpu(state->status.uncorrected_block_count);
return 0;
}
@@ -212,35 +197,16 @@ static int cinergyt2_fe_read_signal_strength(struct dvb_frontend *fe,
u16 *strength)
{
struct cinergyt2_fe_state *state = fe->demodulator_priv;
- struct dvbt_get_status_msg status;
- char cmd[] = { CINERGYT2_EP1_GET_TUNER_STATUS };
- int ret;
- ret = dvb_usb_generic_rw(state->d, cmd, sizeof(cmd), (char *)&status,
- sizeof(status), 0);
- if (ret < 0) {
- err("cinergyt2_fe_read_signal_strength() Failed!"
- " (Error=%d)\n", ret);
- return ret;
- }
- *strength = (0xffff - le16_to_cpu(status.gain));
+ *strength = (0xffff - le16_to_cpu(state->status.gain));
return 0;
}
static int cinergyt2_fe_read_snr(struct dvb_frontend *fe, u16 *snr)
{
struct cinergyt2_fe_state *state = fe->demodulator_priv;
- struct dvbt_get_status_msg status;
- char cmd[] = { CINERGYT2_EP1_GET_TUNER_STATUS };
- int ret;
- ret = dvb_usb_generic_rw(state->d, cmd, sizeof(cmd), (char *)&status,
- sizeof(status), 0);
- if (ret < 0) {
- err("cinergyt2_fe_read_snr() Failed! (Error=%d)\n", ret);
- return ret;
- }
- *snr = (status.snr << 8) | status.snr;
+ *snr = (state->status.snr << 8) | state->status.snr;
return 0;
}
--
2.7.4
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 00/26] Don't use stack for DMA transers on dvb-usb drivers Mauro Carvalho Chehab <mchehab@s-opensource.com> - 2016-10-07 19:30 +0200
[PATCH 21/26] pctv452e: don't call BUG_ON() on non-fatal error Mauro Carvalho Chehab <mchehab@s-opensource.com> - 2016-10-07 19:30 +0200
[PATCH v2 21/26] pctv452e: don't call BUG_ON() on non-fatal error Mauro Carvalho Chehab <mchehab@s-opensource.com> - 2016-10-08 12:20 +0200
[PATCH 26/26] digitv: handle error code on RC query Mauro Carvalho Chehab <mchehab@s-opensource.com> - 2016-10-07 19:30 +0200
[PATCH 06/26] cxusb: don't do DMA on stack Mauro Carvalho Chehab <mchehab@s-opensource.com> - 2016-10-07 19:30 +0200
Re: [PATCH 06/26] cxusb: don't do DMA on stack Patrick Boettcher <patrick.boettcher@posteo.de> - 2016-10-10 08:40 +0200
[PATCH 01/26] af9005: don't do DMA on stack Mauro Carvalho Chehab <mchehab@s-opensource.com> - 2016-10-07 19:30 +0200
[PATCH 11/26] digitv: don't do DMA on stack Mauro Carvalho Chehab <mchehab@s-opensource.com> - 2016-10-07 19:30 +0200
Re: [PATCH 11/26] digitv: don't do DMA on stack Patrick Boettcher <patrick.boettcher@posteo.de> - 2016-10-10 08:40 +0200
[PATCH 02/26] cinergyT2-core: don't do DMA on stack Mauro Carvalho Chehab <mchehab@s-opensource.com> - 2016-10-07 19:30 +0200
Re: [PATCH 02/26] cinergyT2-core: don't do DMA on stack Patrick Boettcher <patrick.boettcher@posteo.de> - 2016-10-10 08:40 +0200
[PATCH 15/26] dtt200u: handle USB control message errors Mauro Carvalho Chehab <mchehab@s-opensource.com> - 2016-10-07 19:30 +0200
[PATCH 14/26] dtt200u: don't do DMA on stack Mauro Carvalho Chehab <mchehab@s-opensource.com> - 2016-10-07 19:30 +0200
Re: [PATCH 14/26] dtt200u: don't do DMA on stack Patrick Boettcher <patrick.boettcher@posteo.de> - 2016-10-10 08:40 +0200
[PATCH 04/26] cinergyT2-fe: cache stats at cinergyt2_fe_read_status() Mauro Carvalho Chehab <mchehab@s-opensource.com> - 2016-10-07 19:30 +0200
[PATCH 18/26] gp8psk: don't go past the buffer size Mauro Carvalho Chehab <mchehab@s-opensource.com> - 2016-10-07 19:30 +0200
[PATCH 07/26] dib0700: be sure that dib0700_ctrl_rd() users can do DMA Mauro Carvalho Chehab <mchehab@s-opensource.com> - 2016-10-07 19:40 +0200
Re: [PATCH 07/26] dib0700: be sure that dib0700_ctrl_rd() users can do DMA Patrick Boettcher <patrick.boettcher@posteo.de> - 2016-10-10 08:40 +0200
[PATCH 17/26] gp8psk: don't do DMA on stack Mauro Carvalho Chehab <mchehab@s-opensource.com> - 2016-10-07 19:40 +0200
[PATCH 23/26] dvb-usb: warn if return value for USB read/write routines is not checked Mauro Carvalho Chehab <mchehab@s-opensource.com> - 2016-10-07 19:40 +0200
csiph-web