From 22a613e89825ea7a3984a968463cc6d425bd8856 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 9 Aug 2016 18:32:26 -0300 Subject: [media] dvb_frontend: merge duplicate dvb_tuner_ops.release implementations Most release callback functions are identical: free the "tuner_priv" and clear it. Let's eliminate some bloat by providing this simple implementation in the dvb_frontend library. Signed-off-by: Max Kellermann Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb-core/dvb_frontend.c | 9 +++++++++ drivers/media/dvb-core/dvb_frontend.h | 7 +++++++ 2 files changed, 16 insertions(+) (limited to 'drivers/media/dvb-core') diff --git a/drivers/media/dvb-core/dvb_frontend.c b/drivers/media/dvb-core/dvb_frontend.c index cdb7048874c5..7c4a50b0b963 100644 --- a/drivers/media/dvb-core/dvb_frontend.c +++ b/drivers/media/dvb-core/dvb_frontend.c @@ -174,6 +174,15 @@ static bool has_get_frontend(struct dvb_frontend *fe) return fe->ops.get_frontend != NULL; } +int +dvb_tuner_simple_release(struct dvb_frontend *fe) +{ + kfree(fe->tuner_priv); + fe->tuner_priv = NULL; + return 0; +} +EXPORT_SYMBOL(dvb_tuner_simple_release); + /* * Due to DVBv3 API calls, a delivery system should be mapped into one of * the 4 DVBv3 delivery systems (FE_QPSK, FE_QAM, FE_OFDM or FE_ATSC), diff --git a/drivers/media/dvb-core/dvb_frontend.h b/drivers/media/dvb-core/dvb_frontend.h index fb6e84811504..6b675a833520 100644 --- a/drivers/media/dvb-core/dvb_frontend.h +++ b/drivers/media/dvb-core/dvb_frontend.h @@ -266,6 +266,13 @@ struct dvb_tuner_ops { int (*set_bandwidth)(struct dvb_frontend *fe, u32 bandwidth); }; +/** + * A common default implementation for dvb_tuner_ops.release. All it + * does is kfree() the tuner_priv and assign NULL to it. + */ +int +dvb_tuner_simple_release(struct dvb_frontend *fe); + /** * struct analog_demod_info - Information struct for analog TV part of the demod * -- cgit v1.2.3