From patchwork Mon Sep 14 09:03:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 255834 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 21781C2BC11 for ; Mon, 14 Sep 2020 09:04:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CB62121741 for ; Mon, 14 Sep 2020 09:04:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600074250; bh=h332aqwhjT3i19kg1+fjgVYyFutF+KieRzVuzn/JuFU=; h=From:Cc:Subject:Date:In-Reply-To:References:To:List-ID:From; b=WdLBTKvywNggnAR/0rR/G88sx6y5r5M2tUnT97IxlmLSMWkQo7vUi7VMLIF9pVO5X LGSITqLR6bdldjp8aqhpVQSnBxknduAdkTJUE38nRKMqdsN2Mey+J7vF1hIlluTFYE cYABnPs0SBTpBZpfH6AJ9KzVSl5OWcUvN3g33usg= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726284AbgINJEJ (ORCPT ); Mon, 14 Sep 2020 05:04:09 -0400 Received: from mail.kernel.org ([198.145.29.99]:37866 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726230AbgINJDg (ORCPT ); Mon, 14 Sep 2020 05:03:36 -0400 Received: from mail.kernel.org (ip5f5ad5d8.dynamic.kabel-deutschland.de [95.90.213.216]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 46EB42222B; Mon, 14 Sep 2020 09:03:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600074212; bh=h332aqwhjT3i19kg1+fjgVYyFutF+KieRzVuzn/JuFU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VJNuBwXEdwsQ4tFr075Djr+gb9yIUXUxZZGvoT1v3j/7+prjzQxMTVzMYWne7Z9C8 5s7wgu+e4JsYzoR1SM92YbxKny8AAol5IBenEnsV0Vjy67h/YG+sMsWHcP7FRumaeC eRK9U6gKTmigAJd3VoAXoTKsqyNkOIL6DYb5Kp9s= Received: from mchehab by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1kHkOV-002dzR-T5; Mon, 14 Sep 2020 11:03:27 +0200 From: Mauro Carvalho Chehab Cc: Mauro Carvalho Chehab , "Daniel W. S. Almeida" , Mauro Carvalho Chehab , linux-kernel@vger.kernel.org, linux-media@vger.kernel.org Subject: [PATCH RFC 01/11] media: vidtv: add modaliases for the bridge driver Date: Mon, 14 Sep 2020 11:03:16 +0200 Message-Id: <84d83d54ea230c27cdba521fb2f1d916571512f8.1600073975.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: References: MIME-Version: 1.0 To: unlisted-recipients:; (no To-header on input) Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org As this virtual driver is probed manually, add modaliases for this driver. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/test-drivers/vidtv/vidtv_bridge.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/media/test-drivers/vidtv/vidtv_bridge.c b/drivers/media/test-drivers/vidtv/vidtv_bridge.c index 82e375048b99..9f0e53e9fe69 100644 --- a/drivers/media/test-drivers/vidtv/vidtv_bridge.c +++ b/drivers/media/test-drivers/vidtv/vidtv_bridge.c @@ -530,3 +530,5 @@ module_exit(vidtv_bridge_exit); MODULE_DESCRIPTION("Virtual Digital TV Test Driver"); MODULE_AUTHOR("Daniel W. S. Almeida"); MODULE_LICENSE("GPL"); +MODULE_ALIAS("vidtv"); +MODULE_ALIAS("dvb_vidtv"); From patchwork Mon Sep 14 09:03:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 255836 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5E67FC2BC11 for ; Mon, 14 Sep 2020 09:03:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 06D5E21D1A for ; Mon, 14 Sep 2020 09:03:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600074232; bh=rcf9qiinGewlooZVkc80E5ROEyjsEkJ+kBVWXO6MfGo=; h=From:Cc:Subject:Date:In-Reply-To:References:To:List-ID:From; b=g17l01Qk/UraiSqH/XiFOYEGG6EbHmKIkyaaeKwTf42x86BoQ0cHraM/52j5QeGaO aQC+o/imfAdHhfcsSlb+Gz+UfLU78cHDL9jCQmXYnZKGBNuqM9+HVB+3qMhdy3B899 /gZ14SCBvQTQzd4k6WatiDiB9RnYCCHslOniXDYE= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726248AbgINJDk (ORCPT ); Mon, 14 Sep 2020 05:03:40 -0400 Received: from mail.kernel.org ([198.145.29.99]:37758 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726210AbgINJDd (ORCPT ); Mon, 14 Sep 2020 05:03:33 -0400 Received: from mail.kernel.org (ip5f5ad5d8.dynamic.kabel-deutschland.de [95.90.213.216]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D6E9E22207; Mon, 14 Sep 2020 09:03:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600074212; bh=rcf9qiinGewlooZVkc80E5ROEyjsEkJ+kBVWXO6MfGo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=M3jkEYfvkJ3LiVAkEaFoiwVKTnzVts3tDThP7S04fKvO/mlPuhouTwWqX0a0QGQNo wK63sOdqMxhRlr+mw+9bvrucwZhCBG3k3j44S9BRjYSLIFLPA19CD8MqAplz20M7Oc cFEP6anraTd2v3PdTe2UFevuEHne+zVSifSe77pQ= Received: from mchehab by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1kHkOV-002dzT-Ua; Mon, 14 Sep 2020 11:03:27 +0200 From: Mauro Carvalho Chehab Cc: Mauro Carvalho Chehab , "Daniel W. S. Almeida" , Mauro Carvalho Chehab , linux-kernel@vger.kernel.org, linux-media@vger.kernel.org Subject: [PATCH RFC 02/11] media: vidtv: prefer using dev_foo() instead of pr_foo() Date: Mon, 14 Sep 2020 11:03:17 +0200 Message-Id: <42cc95a5048dc553f3362d42ba5035d6f4fe9a1e.1600073975.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: References: MIME-Version: 1.0 To: unlisted-recipients:; (no To-header on input) Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org It is better to use the higher level dev_foo() than pr_foo() for printks. Change them at vidtv at the more trivial places. Signed-off-by: Mauro Carvalho Chehab --- .../media/test-drivers/vidtv/vidtv_bridge.c | 19 +++++++-------- .../media/test-drivers/vidtv/vidtv_channel.c | 23 ++++++++++--------- .../media/test-drivers/vidtv/vidtv_demod.c | 10 ++++---- drivers/media/test-drivers/vidtv/vidtv_mux.c | 18 ++++++++------- drivers/media/test-drivers/vidtv/vidtv_mux.h | 5 +++- .../media/test-drivers/vidtv/vidtv_tuner.c | 17 +++++++------- 6 files changed, 51 insertions(+), 41 deletions(-) diff --git a/drivers/media/test-drivers/vidtv/vidtv_bridge.c b/drivers/media/test-drivers/vidtv/vidtv_bridge.c index 9f0e53e9fe69..270c183b1d67 100644 --- a/drivers/media/test-drivers/vidtv/vidtv_bridge.c +++ b/drivers/media/test-drivers/vidtv/vidtv_bridge.c @@ -9,12 +9,10 @@ * Copyright (C) 2020 Daniel W. S. Almeida */ -#define pr_fmt(fmt) KBUILD_MODNAME ":%s, %d: " fmt, __func__, __LINE__ - #include #include #include -#include +#include #include #include #include @@ -146,10 +144,11 @@ vidtv_bridge_on_new_pkts_avail(void *priv, u8 *buf, u32 npkts) static int vidtv_start_streaming(struct vidtv_dvb *dvb) { struct vidtv_mux_init_args mux_args = {0}; + struct device *dev = &dvb->pdev->dev; u32 mux_buf_sz; if (dvb->streaming) { - pr_warn_ratelimited("Already streaming. Skipping.\n"); + dev_warn_ratelimited(dev, "Already streaming. Skipping.\n"); return 0; } @@ -165,21 +164,23 @@ static int vidtv_start_streaming(struct vidtv_dvb *dvb) mux_args.priv = dvb; dvb->streaming = true; - dvb->mux = vidtv_mux_init(mux_args); + dvb->mux = vidtv_mux_init(dev, mux_args); vidtv_mux_start_thread(dvb->mux); - pr_info_ratelimited("Started streaming\n"); + dev_dbg_ratelimited(dev, "Started streaming\n"); return 0; } static int vidtv_stop_streaming(struct vidtv_dvb *dvb) { + struct device *dev = &dvb->pdev->dev; + dvb->streaming = false; vidtv_mux_stop_thread(dvb->mux); vidtv_mux_destroy(dvb->mux); dvb->mux = NULL; - pr_info_ratelimited("Stopped streaming\n"); + dev_dbg_ratelimited(dev, "Stopped streaming\n"); return 0; } @@ -438,8 +439,8 @@ static int vidtv_bridge_dvb_init(struct vidtv_dvb *dvb) static int vidtv_bridge_probe(struct platform_device *pdev) { - int ret; struct vidtv_dvb *dvb; + int ret; dvb = kzalloc(sizeof(*dvb), GFP_KERNEL); if (!dvb) @@ -455,7 +456,7 @@ static int vidtv_bridge_probe(struct platform_device *pdev) platform_set_drvdata(pdev, dvb); - pr_info("Successfully initialized vidtv!\n"); + dev_info(&pdev->dev, "Successfully initialized vidtv!\n"); return ret; err_dvb: diff --git a/drivers/media/test-drivers/vidtv/vidtv_channel.c b/drivers/media/test-drivers/vidtv/vidtv_channel.c index ac4bdf05395e..0a62b97e6a27 100644 --- a/drivers/media/test-drivers/vidtv/vidtv_channel.c +++ b/drivers/media/test-drivers/vidtv/vidtv_channel.c @@ -18,11 +18,9 @@ * Copyright (C) 2020 Daniel W. S. Almeida */ -#define pr_fmt(fmt) KBUILD_MODNAME ":%s, %d: " fmt, __func__, __LINE__ - #include #include -#include +#include #include #include "vidtv_channel.h" @@ -104,10 +102,10 @@ struct vidtv_channel } static struct vidtv_psi_table_sdt_service -*vidtv_channel_sdt_serv_cat_into_new(const struct vidtv_channel *channels) +*vidtv_channel_sdt_serv_cat_into_new(struct vidtv_mux *m) { /* Concatenate the services */ - const struct vidtv_channel *cur_chnl = channels; + const struct vidtv_channel *cur_chnl = m->channels; struct vidtv_psi_table_sdt_service *curr = NULL; struct vidtv_psi_table_sdt_service *head = NULL; @@ -123,7 +121,8 @@ static struct vidtv_psi_table_sdt_service curr = cur_chnl->service; if (!curr) - pr_warn_ratelimited("No services found for channel %s\n", cur_chnl->name); + dev_warn_ratelimited(m->dev, + "No services found for channel %s\n", cur_chnl->name); while (curr) { service_id = be16_to_cpu(curr->service_id); @@ -145,10 +144,10 @@ static struct vidtv_psi_table_sdt_service } static struct vidtv_psi_table_pat_program* -vidtv_channel_pat_prog_cat_into_new(const struct vidtv_channel *channels) +vidtv_channel_pat_prog_cat_into_new(struct vidtv_mux *m) { /* Concatenate the programs */ - const struct vidtv_channel *cur_chnl = channels; + const struct vidtv_channel *cur_chnl = m->channels; struct vidtv_psi_table_pat_program *curr = NULL; struct vidtv_psi_table_pat_program *head = NULL; struct vidtv_psi_table_pat_program *tail = NULL; @@ -162,7 +161,9 @@ vidtv_channel_pat_prog_cat_into_new(const struct vidtv_channel *channels) curr = cur_chnl->program; if (!curr) - pr_warn_ratelimited("No programs found for channel %s\n", cur_chnl->name); + dev_warn_ratelimited(m->dev, + "No programs found for channel %s\n", + cur_chnl->name); while (curr) { serv_id = be16_to_cpu(curr->service_id); @@ -251,8 +252,8 @@ void vidtv_channel_si_init(struct vidtv_mux *m) m->si.sdt = vidtv_psi_sdt_table_init(m->transport_stream_id); - programs = vidtv_channel_pat_prog_cat_into_new(m->channels); - services = vidtv_channel_sdt_serv_cat_into_new(m->channels); + programs = vidtv_channel_pat_prog_cat_into_new(m); + services = vidtv_channel_sdt_serv_cat_into_new(m); /* assemble all programs and assign to PAT */ vidtv_psi_pat_program_assign(m->si.pat, programs); diff --git a/drivers/media/test-drivers/vidtv/vidtv_demod.c b/drivers/media/test-drivers/vidtv/vidtv_demod.c index d18860fcb0e7..3eb48b4a9a6b 100644 --- a/drivers/media/test-drivers/vidtv/vidtv_demod.c +++ b/drivers/media/test-drivers/vidtv/vidtv_demod.c @@ -76,8 +76,9 @@ static const struct vidtv_demod_cnr_to_qual_s vidtv_demod_t_cnr_2_qual[] = { static const struct vidtv_demod_cnr_to_qual_s *vidtv_match_cnr_s(struct dvb_frontend *fe) { + const struct vidtv_demod_cnr_to_qual_s *cnr2qual = NULL; + struct device *dev = fe->dvb->device; struct dtv_frontend_properties *c; - const struct vidtv_demod_cnr_to_qual_s *cnr2qual = NULL; u32 array_size = 0; u32 i; @@ -106,9 +107,10 @@ static const struct vidtv_demod_cnr_to_qual_s break; default: - pr_warn_ratelimited("%s: unsupported delivery system: %u\n", - __func__, - c->delivery_system); + dev_warn_ratelimited(dev, + "%s: unsupported delivery system: %u\n", + __func__, + c->delivery_system); break; } diff --git a/drivers/media/test-drivers/vidtv/vidtv_mux.c b/drivers/media/test-drivers/vidtv/vidtv_mux.c index 540f404372aa..d1db9dc6dc89 100644 --- a/drivers/media/test-drivers/vidtv/vidtv_mux.c +++ b/drivers/media/test-drivers/vidtv/vidtv_mux.c @@ -12,13 +12,11 @@ * Copyright (C) 2020 Daniel W. S. Almeida */ -#define pr_fmt(fmt) KBUILD_MODNAME ":%s, %d: " fmt, __func__, __LINE__ - #include #include #include #include -#include +#include #include #include #include @@ -147,7 +145,8 @@ static u32 vidtv_mux_push_si(struct vidtv_mux *m) m->si.pat); if (pmt_pid > TS_LAST_VALID_PID) { - pr_warn_ratelimited("PID: %d not found\n", pmt_pid); + dev_warn_ratelimited(m->dev, + "PID: %d not found\n", pmt_pid); continue; } @@ -331,7 +330,8 @@ static u32 vidtv_mux_pad_with_nulls(struct vidtv_mux *m, u32 npkts) /* sanity check */ if (nbytes != npkts * TS_PACKET_LEN) - pr_err_ratelimited("%d != %d\n", nbytes, npkts * TS_PACKET_LEN); + dev_err_ratelimited(m->dev, "%d != %d\n", + nbytes, npkts * TS_PACKET_LEN); return nbytes; } @@ -402,7 +402,7 @@ static void vidtv_mux_tick(struct work_struct *work) /* if the buffer is not aligned there is a bug somewhere */ if (nbytes % TS_PACKET_LEN) - pr_err_ratelimited("Misaligned buffer\n"); + dev_err_ratelimited(m->dev, "Misaligned buffer\n"); if (m->on_new_packets_available_cb) m->on_new_packets_available_cb(m->priv, @@ -418,7 +418,7 @@ static void vidtv_mux_tick(struct work_struct *work) void vidtv_mux_start_thread(struct vidtv_mux *m) { if (m->streaming) { - pr_warn_ratelimited("Already streaming. Skipping.\n"); + dev_warn_ratelimited(m->dev, "Already streaming. Skipping.\n"); return; } @@ -435,10 +435,12 @@ void vidtv_mux_stop_thread(struct vidtv_mux *m) } } -struct vidtv_mux *vidtv_mux_init(struct vidtv_mux_init_args args) +struct vidtv_mux *vidtv_mux_init(struct device *dev, + struct vidtv_mux_init_args args) { struct vidtv_mux *m = kzalloc(sizeof(*m), GFP_KERNEL); + m->dev = dev; m->timing.pcr_period_usecs = args.pcr_period_usecs; m->timing.si_period_usecs = args.si_period_usecs; diff --git a/drivers/media/test-drivers/vidtv/vidtv_mux.h b/drivers/media/test-drivers/vidtv/vidtv_mux.h index 8622a62cd9bc..67de85fd50aa 100644 --- a/drivers/media/test-drivers/vidtv/vidtv_mux.h +++ b/drivers/media/test-drivers/vidtv/vidtv_mux.h @@ -100,6 +100,8 @@ struct vidtv_mux_pid_ctx { * @priv: Private data. */ struct vidtv_mux { + struct device *dev; + struct vidtv_mux_timing timing; u32 mux_rate_kbytes_sec; @@ -151,7 +153,8 @@ struct vidtv_mux_init_args { void *priv; }; -struct vidtv_mux *vidtv_mux_init(struct vidtv_mux_init_args args); +struct vidtv_mux *vidtv_mux_init(struct device *dev, + struct vidtv_mux_init_args args); void vidtv_mux_destroy(struct vidtv_mux *m); void vidtv_mux_start_thread(struct vidtv_mux *m); diff --git a/drivers/media/test-drivers/vidtv/vidtv_tuner.c b/drivers/media/test-drivers/vidtv/vidtv_tuner.c index c8e64bab0379..39e848ae5836 100644 --- a/drivers/media/test-drivers/vidtv/vidtv_tuner.c +++ b/drivers/media/test-drivers/vidtv/vidtv_tuner.c @@ -10,8 +10,6 @@ * Copyright (C) 2020 Daniel W. S. Almeida */ -#define pr_fmt(fmt) KBUILD_MODNAME ":%s, %d: " fmt, __func__, __LINE__ - #include #include #include @@ -149,9 +147,10 @@ static s32 vidtv_tuner_check_frequency_shift(struct dvb_frontend *fe) break; default: - pr_warn("%s: unsupported delivery system: %u\n", - __func__, - c->delivery_system); + dev_warn(fe->dvb->device, + "%s: unsupported delivery system: %u\n", + __func__, + c->delivery_system); return -EINVAL; } @@ -179,6 +178,7 @@ vidtv_tuner_get_signal_strength(struct dvb_frontend *fe, u16 *strength) { struct dtv_frontend_properties *c = &fe->dtv_property_cache; const struct vidtv_tuner_cnr_to_qual_s *cnr2qual = NULL; + struct device *dev = fe->dvb->device; u32 array_size = 0; s32 shift; u32 i; @@ -208,9 +208,10 @@ vidtv_tuner_get_signal_strength(struct dvb_frontend *fe, u16 *strength) break; default: - pr_warn_ratelimited("%s: unsupported delivery system: %u\n", - __func__, - c->delivery_system); + dev_warn_ratelimited(dev, + "%s: unsupported delivery system: %u\n", + __func__, + c->delivery_system); return -EINVAL; } From patchwork Mon Sep 14 09:03:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 255833 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6E0F9C43461 for ; Mon, 14 Sep 2020 09:04:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 205A6221E8 for ; Mon, 14 Sep 2020 09:04:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600074279; bh=0PU/DNFt4f6Rzyiw/4kbN0uHCEIwJDLqO3MyGp9lp6U=; h=From:Cc:Subject:Date:In-Reply-To:References:To:List-ID:From; b=Yam9v+4RpO1eHcx1zlgsQMg6BM5z4EYD4QSQD1voe5tf4CWAQty1PqlGPfZs+IPlP Ig2iHgp3mavtgxNsgGPQgfa0Wb2uBAFmX/Tdrz8QBItGl5CYbXDioXEMHg7QHqoFg/ wPxKRpmsD8A5PqluOyBPRUjHy22jmq11pFqWyz9I= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726310AbgINJEa (ORCPT ); Mon, 14 Sep 2020 05:04:30 -0400 Received: from mail.kernel.org ([198.145.29.99]:37862 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726222AbgINJDg (ORCPT ); Mon, 14 Sep 2020 05:03:36 -0400 Received: from mail.kernel.org (ip5f5ad5d8.dynamic.kabel-deutschland.de [95.90.213.216]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E80422220A; Mon, 14 Sep 2020 09:03:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600074212; bh=0PU/DNFt4f6Rzyiw/4kbN0uHCEIwJDLqO3MyGp9lp6U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Dsaw98HxiG8Qz5Lh2DNSZQeuBZ7/9KGo0zRzern2oUESiiSCYqNDi3uNa++Qtin/v MMk+SJVc5jrneSI1426ptYQ6Zze7wurzbV5Io+BmLTWeQMubSai2s1UUpLChzEp0n4 1n2GJ6BCz/jeaCpLnUSUtzDlu3lkNf9OAy/U1WgE= Received: from mchehab by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1kHkOW-002dza-2X; Mon, 14 Sep 2020 11:03:28 +0200 From: Mauro Carvalho Chehab Cc: Mauro Carvalho Chehab , "Daniel W. S. Almeida" , Mauro Carvalho Chehab , linux-kernel@vger.kernel.org, linux-media@vger.kernel.org Subject: [PATCH RFC 05/11] media: vidtv: add an initial channel frequency Date: Mon, 14 Sep 2020 11:03:20 +0200 Message-Id: <9893bb388395da2559bfd212e2d354fe83d3eccb.1600073975.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: References: MIME-Version: 1.0 To: unlisted-recipients:; (no To-header on input) Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Use 474 MHz frequency for DVB-T/DVB-C, as this is the first channel that it is valid on most places for DVB-T. In the case of DVB-S, let's add Astra 19.2E initial frequency at the scan files as the default, e. g. 12.5515 GHz. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/test-drivers/vidtv/vidtv_bridge.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/drivers/media/test-drivers/vidtv/vidtv_bridge.c b/drivers/media/test-drivers/vidtv/vidtv_bridge.c index 270c183b1d67..cb32f82f88f9 100644 --- a/drivers/media/test-drivers/vidtv/vidtv_bridge.c +++ b/drivers/media/test-drivers/vidtv/vidtv_bridge.c @@ -47,17 +47,25 @@ static unsigned int mock_tune_delay_msec; module_param(mock_tune_delay_msec, uint, 0); MODULE_PARM_DESC(mock_tune_delay_msec, "Simulate a tune delay"); -static unsigned int vidtv_valid_dvb_t_freqs[NUM_VALID_TUNER_FREQS]; +static unsigned int vidtv_valid_dvb_t_freqs[NUM_VALID_TUNER_FREQS] = { + 474000000 +}; + module_param_array(vidtv_valid_dvb_t_freqs, uint, NULL, 0); MODULE_PARM_DESC(vidtv_valid_dvb_t_freqs, "Valid DVB-T frequencies to simulate"); -static unsigned int vidtv_valid_dvb_c_freqs[NUM_VALID_TUNER_FREQS]; +static unsigned int vidtv_valid_dvb_c_freqs[NUM_VALID_TUNER_FREQS] = { + 474000000 +}; + module_param_array(vidtv_valid_dvb_c_freqs, uint, NULL, 0); MODULE_PARM_DESC(vidtv_valid_dvb_c_freqs, "Valid DVB-C frequencies to simulate"); -static unsigned int vidtv_valid_dvb_s_freqs[NUM_VALID_TUNER_FREQS]; +static unsigned int vidtv_valid_dvb_s_freqs[NUM_VALID_TUNER_FREQS] = { + 12551500 +}; module_param_array(vidtv_valid_dvb_s_freqs, uint, NULL, 0); MODULE_PARM_DESC(vidtv_valid_dvb_s_freqs, "Valid DVB-C frequencies to simulate"); From patchwork Mon Sep 14 09:03:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 255832 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, UNWANTED_LANGUAGE_BODY, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9043BC43461 for ; Mon, 14 Sep 2020 09:04:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 563A8207C3 for ; Mon, 14 Sep 2020 09:04:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600074288; bh=4IMF1YyMrDjVjNyzMc5sg5d+r3DMhGTnklBhVqgY1RI=; h=From:Cc:Subject:Date:In-Reply-To:References:To:List-ID:From; b=aoa6z5+fD8H9YXoT9yhZpbjx5UvgHjeSJ82yIzsACfTKm4AwSro60HFX/Rus1xFuB sWQvaTWFnoAWJQsKPnp6OT2hfRwm5QZoZyK+L9HLmzxUWUKG6s5Ll678Cz95VfRwdl E3Iq+lzjLs94UBr14VbHTV/FvRPQaGGYKzDEDRzk= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726135AbgINJEr (ORCPT ); Mon, 14 Sep 2020 05:04:47 -0400 Received: from mail.kernel.org ([198.145.29.99]:37682 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726203AbgINJDc (ORCPT ); Mon, 14 Sep 2020 05:03:32 -0400 Received: from mail.kernel.org (ip5f5ad5d8.dynamic.kabel-deutschland.de [95.90.213.216]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7F47221741; Mon, 14 Sep 2020 09:03:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600074211; bh=4IMF1YyMrDjVjNyzMc5sg5d+r3DMhGTnklBhVqgY1RI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MzeMcpqxYyfeF3qP9RCLqO5rWRsjausW+UPIce68cWG/j30sGBeYPFdI+X/ig2p/e 3fYkzp+hhPAjDgs4nM9geKOujQzZpFOhBQ9gili9A1rt5cphkiCBuaLWmz900Oy8hS xQCUXs2fYhiA3qE5KbbDFhlXHDW75Ivfkiivj9oQ= Received: from mchehab by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1kHkOW-002dzd-3Q; Mon, 14 Sep 2020 11:03:28 +0200 From: Mauro Carvalho Chehab Cc: Mauro Carvalho Chehab , "Daniel W. S. Almeida" , Mauro Carvalho Chehab , linux-kernel@vger.kernel.org, linux-media@vger.kernel.org Subject: [PATCH RFC 06/11] media: vidtv: get rid of some endiannes nonsense Date: Mon, 14 Sep 2020 11:03:21 +0200 Message-Id: <47ccbcbd23e44159bbb11274b540d7c2bb66be7c.1600073975.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: References: MIME-Version: 1.0 To: unlisted-recipients:; (no To-header on input) Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Genmask is always highest order to low order. It doesn't make any sense to make it depends on endiannes. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/test-drivers/vidtv/vidtv_psi.c | 32 -------------------- 1 file changed, 32 deletions(-) diff --git a/drivers/media/test-drivers/vidtv/vidtv_psi.c b/drivers/media/test-drivers/vidtv/vidtv_psi.c index 761034d10d9d..b8b638244b1d 100644 --- a/drivers/media/test-drivers/vidtv/vidtv_psi.c +++ b/drivers/media/test-drivers/vidtv/vidtv_psi.c @@ -99,11 +99,7 @@ static inline u16 vidtv_psi_sdt_serv_get_desc_loop_len(struct vidtv_psi_table_sd u16 mask; u16 ret; - #if defined(__BIG_ENDIAN) - mask = GENMASK(0, 11); - #else mask = GENMASK(11, 0); - #endif ret = be16_to_cpu(s->bitfield) & mask; return ret; @@ -114,11 +110,7 @@ static inline u16 vidtv_psi_pmt_stream_get_desc_loop_len(struct vidtv_psi_table_ u16 mask; u16 ret; - #if defined(__BIG_ENDIAN) - mask = GENMASK(0, 9); - #else mask = GENMASK(9, 0); - #endif ret = be16_to_cpu(s->bitfield2) & mask; return ret; @@ -129,11 +121,7 @@ static inline u16 vidtv_psi_pmt_get_desc_loop_len(struct vidtv_psi_table_pmt *p) u16 mask; u16 ret; - #if defined(__BIG_ENDIAN) - mask = GENMASK(0, 9); - #else mask = GENMASK(9, 0); - #endif ret = be16_to_cpu(p->bitfield2) & mask; return ret; @@ -144,11 +132,7 @@ static inline u16 vidtv_psi_get_sec_len(struct vidtv_psi_table_header *h) u16 mask; u16 ret; - #if defined(__BIG_ENDIAN) - mask = GENMASK(0, 11); - #else mask = GENMASK(11, 0); - #endif ret = be16_to_cpu(h->bitfield) & mask; return ret; @@ -159,11 +143,7 @@ inline u16 vidtv_psi_get_pat_program_pid(struct vidtv_psi_table_pat_program *p) u16 mask; u16 ret; - #if defined(__BIG_ENDIAN) - mask = GENMASK(0, 12); - #else mask = GENMASK(12, 0); - #endif ret = be16_to_cpu(p->bitfield) & mask; return ret; @@ -174,11 +154,7 @@ inline u16 vidtv_psi_pmt_stream_get_elem_pid(struct vidtv_psi_table_pmt_stream * u16 mask; u16 ret; - #if defined(__BIG_ENDIAN) - mask = GENMASK(0, 12); - #else mask = GENMASK(12, 0); - #endif ret = be16_to_cpu(s->bitfield) & mask; return ret; @@ -189,11 +165,7 @@ static inline void vidtv_psi_set_desc_loop_len(__be16 *bitfield, u16 new_len, u8 u16 mask; __be16 new; - #if defined(__BIG_ENDIAN) - mask = GENMASK(desc_len_nbits, 15); - #else mask = GENMASK(15, desc_len_nbits); - #endif new = cpu_to_be16((be16_to_cpu(*bitfield) & mask) | new_len); *bitfield = new; @@ -205,11 +177,7 @@ static void vidtv_psi_set_sec_len(struct vidtv_psi_table_header *h, u16 new_len) __be16 new; u16 mask; - #if defined(__BIG_ENDIAN) - mask = GENMASK(13, 15); - #else mask = GENMASK(15, 13); - #endif new = cpu_to_be16((be16_to_cpu(h->bitfield) & mask) | new_len); From patchwork Mon Sep 14 09:03:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 255831 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 86097C433E2 for ; Mon, 14 Sep 2020 09:05:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 328D0221F0 for ; Mon, 14 Sep 2020 09:05:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600074308; bh=yn4rC/mpMg6Y49QUXHu+kh/MepPer+40IA5SSwhxib0=; h=From:Cc:Subject:Date:In-Reply-To:References:To:List-ID:From; b=ulraoeoSZMnte0Fpb5OWPpIwzFQ+ncTMrDo2GIwbeeSFiPYTxKWlZwGE/rNreJy77 EstFWTZA08F2TcEatlouAPAiccAWm+irxaxgYNXS1kZ1o2g8HaRIKH1eeiWPikN1fY aptSc+od/fjsFjmxxzb/fCUlJ3AF19akmtL+V5jI= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726319AbgINJEo (ORCPT ); Mon, 14 Sep 2020 05:04:44 -0400 Received: from mail.kernel.org ([198.145.29.99]:37864 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726225AbgINJDg (ORCPT ); Mon, 14 Sep 2020 05:03:36 -0400 Received: from mail.kernel.org (ip5f5ad5d8.dynamic.kabel-deutschland.de [95.90.213.216]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id F25BD2220D; Mon, 14 Sep 2020 09:03:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600074212; bh=yn4rC/mpMg6Y49QUXHu+kh/MepPer+40IA5SSwhxib0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZNqZifMaRzqfCicyneaDvwsbeBbBI3tCjtcgneXEXAviuGZc+LhyXVKRBxBGRnNSX Qha9FiwsXRpoY5ZvfQc2GaD+b7thrmv0j564lGta81IR80oR0iksgdSem+TcG2uXSe 6ItUF8QZxCYs938xleISIFpDFVVTbyh/stCtf/go= Received: from mchehab by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1kHkOW-002dzi-5J; Mon, 14 Sep 2020 11:03:28 +0200 From: Mauro Carvalho Chehab Cc: Mauro Carvalho Chehab , "Daniel W. S. Almeida" , Mauro Carvalho Chehab , linux-kernel@vger.kernel.org, linux-media@vger.kernel.org Subject: [PATCH RFC 08/11] media: vidtv: properly initialize the internal state struct Date: Mon, 14 Sep 2020 11:03:23 +0200 Message-Id: <22b323ff01a900c01bf9e407c4130f82f62fe312.1600073975.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: References: MIME-Version: 1.0 To: unlisted-recipients:; (no To-header on input) Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Right now, the config data passed from the bridge driver is just ignored. Also, let's initialize the delayed work at probing time. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/test-drivers/vidtv/vidtv_demod.c | 10 +++++----- drivers/media/test-drivers/vidtv/vidtv_demod.h | 1 - 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/media/test-drivers/vidtv/vidtv_demod.c b/drivers/media/test-drivers/vidtv/vidtv_demod.c index 3eb48b4a9a6b..6199a4e06ff9 100644 --- a/drivers/media/test-drivers/vidtv/vidtv_demod.c +++ b/drivers/media/test-drivers/vidtv/vidtv_demod.c @@ -268,10 +268,6 @@ static int vidtv_demod_init(struct dvb_frontend *fe) struct vidtv_demod_state *state = fe->demodulator_priv; u32 tuner_status = 0; - if (state->cold_start) - INIT_DELAYED_WORK(&state->poll_snr, - &vidtv_demod_poll_snr_handler); - /* * At resume, start the snr poll thread only if it was suspended with * the thread running. Extra care should be taken here, as some tuner @@ -288,7 +284,6 @@ static int vidtv_demod_init(struct dvb_frontend *fe) state->poll_snr_thread_restart = false; } - state->cold_start = false; return 0; } @@ -396,6 +391,7 @@ MODULE_DEVICE_TABLE(i2c, vidtv_demod_i2c_id_table); static int vidtv_demod_i2c_probe(struct i2c_client *client, const struct i2c_device_id *id) { + struct vidtv_tuner_config *config = client->dev.platform_data; struct vidtv_demod_state *state; /* allocate memory for the internal state */ @@ -408,6 +404,10 @@ static int vidtv_demod_i2c_probe(struct i2c_client *client, &vidtv_demod_ops, sizeof(struct dvb_frontend_ops)); + memcpy(&state->config, config, sizeof(state->config)); + + INIT_DELAYED_WORK(&state->poll_snr, &vidtv_demod_poll_snr_handler); + state->frontend.demodulator_priv = state; i2c_set_clientdata(client, state); diff --git a/drivers/media/test-drivers/vidtv/vidtv_demod.h b/drivers/media/test-drivers/vidtv/vidtv_demod.h index dfb36c515e4d..7f52a537935b 100644 --- a/drivers/media/test-drivers/vidtv/vidtv_demod.h +++ b/drivers/media/test-drivers/vidtv/vidtv_demod.h @@ -66,7 +66,6 @@ struct vidtv_demod_state { struct delayed_work poll_snr; enum fe_status status; u16 tuner_cnr; - bool cold_start; bool poll_snr_thread_running; bool poll_snr_thread_restart; }; From patchwork Mon Sep 14 09:03:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 255835 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A9FA5C433E2 for ; Mon, 14 Sep 2020 09:04:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 58171207C3 for ; Mon, 14 Sep 2020 09:04:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600074248; bh=yM9N4NLqi4WGMy1CjkjYEiUQeXobHjZl0q9V8IJvvnw=; h=From:Cc:Subject:Date:In-Reply-To:References:To:List-ID:From; b=j1wgn1DQ5ljXZUWwIEAx+lzLKranhVda/9jmCwHPODTPjbiKOo9N7TSQLb1TGAMCz IkqAqL7ganrfdBLo8FgEPWWPIvDm5C5YSdlHjf369ArDAaNUnSs20ymSqLXfjRJ/xO PMKbRO9UaPa8qzCnT3DAocbF2ie4ecW1vqu98UaQ= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726266AbgINJEB (ORCPT ); Mon, 14 Sep 2020 05:04:01 -0400 Received: from mail.kernel.org ([198.145.29.99]:37860 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726224AbgINJDh (ORCPT ); Mon, 14 Sep 2020 05:03:37 -0400 Received: from mail.kernel.org (ip5f5ad5d8.dynamic.kabel-deutschland.de [95.90.213.216]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 1CDE122224; Mon, 14 Sep 2020 09:03:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600074212; bh=yM9N4NLqi4WGMy1CjkjYEiUQeXobHjZl0q9V8IJvvnw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=W0ixixNjC6rmc3WHHWCUL/qUObi09L5Hk+Et5MpqrtogUcaAPRZkcC64OiWEfSQkF k9mkhFvvQ92LZynMuTCW0v2dbSOnukKel3yCySAS7gOILG1Rim5DBe60NhMlizn90S EezoHaOC+NZ9oXmMfpZbHTzB6QiwEBrkPMCPe0oU= Received: from mchehab by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1kHkOW-002dzn-7X; Mon, 14 Sep 2020 11:03:28 +0200 From: Mauro Carvalho Chehab Cc: Mauro Carvalho Chehab , "Daniel W. S. Almeida" , Mauro Carvalho Chehab , linux-kernel@vger.kernel.org, linux-media@vger.kernel.org Subject: [PATCH RFC 10/11] media: vidtv: get rid of the work queue Date: Mon, 14 Sep 2020 11:03:25 +0200 Message-Id: X-Mailer: git-send-email 2.26.2 In-Reply-To: References: MIME-Version: 1.0 To: unlisted-recipients:; (no To-header on input) Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org The dvb_frontend will already call status periodically, when a channel is tuned. So, no need to have a work queue for such purpose. Signed-off-by: Mauro Carvalho Chehab --- .../media/test-drivers/vidtv/vidtv_demod.c | 77 ++----------------- .../media/test-drivers/vidtv/vidtv_demod.h | 3 - 2 files changed, 6 insertions(+), 74 deletions(-) diff --git a/drivers/media/test-drivers/vidtv/vidtv_demod.c b/drivers/media/test-drivers/vidtv/vidtv_demod.c index bfe63d7160f2..c54c88cac84f 100644 --- a/drivers/media/test-drivers/vidtv/vidtv_demod.c +++ b/drivers/media/test-drivers/vidtv/vidtv_demod.c @@ -190,26 +190,21 @@ static void vidtv_demod_update_stats(struct dvb_frontend *fe) } -static void vidtv_demod_poll_snr_handler(struct work_struct *work) +static int vidtv_demod_read_status(struct dvb_frontend *fe, + enum fe_status *status) { - /* - * periodically check the signal quality and eventually - * lose the TS lock if it dips too low - */ - struct vidtv_demod_state *state; + struct vidtv_demod_state *state = fe->demodulator_priv; const struct vidtv_demod_cnr_to_qual_s *cnr2qual = NULL; - struct vidtv_demod_config *config; + struct vidtv_demod_config *config = &state->config; u16 snr = 0; - state = container_of(work, struct vidtv_demod_state, poll_snr.work); - config = &state->config; - /* Simulate random lost of signal due to a bad-tuned channel */ cnr2qual = vidtv_match_cnr_s(&state->frontend); if (cnr2qual && state->tuner_cnr < cnr2qual->cnr_good && state->frontend.ops.tuner_ops.get_rf_strength) { - state->frontend.ops.tuner_ops.get_rf_strength(&state->frontend, &snr); + state->frontend.ops.tuner_ops.get_rf_strength(&state->frontend, + &snr); if (snr < cnr2qual->cnr_ok) { /* eventually lose the TS lock */ @@ -229,15 +224,6 @@ static void vidtv_demod_poll_snr_handler(struct work_struct *work) vidtv_demod_update_stats(&state->frontend); - schedule_delayed_work(&state->poll_snr, - msecs_to_jiffies(POLL_THRD_TIME)); -} - -static int vidtv_demod_read_status(struct dvb_frontend *fe, - enum fe_status *status) -{ - struct vidtv_demod_state *state = fe->demodulator_priv; - *status = state->status; return 0; @@ -296,55 +282,12 @@ static int vidtv_demod_set_frontend(struct dvb_frontend *fe) vidtv_demod_update_stats(fe); - if (state->tuner_cnr > 0) { - schedule_delayed_work(&state->poll_snr, - msecs_to_jiffies(POLL_THRD_TIME)); - - state->poll_snr_thread_running = true; - } - if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0); return 0; } -static int vidtv_demod_sleep(struct dvb_frontend *fe) -{ - struct vidtv_demod_state *state = fe->demodulator_priv; - - if (state->poll_snr_thread_running) { - cancel_delayed_work_sync(&state->poll_snr); - state->poll_snr_thread_running = false; - state->poll_snr_thread_restart = true; - } - return 0; -} - -static int vidtv_demod_init(struct dvb_frontend *fe) -{ - struct vidtv_demod_state *state = fe->demodulator_priv; - u32 tuner_status = 0; - - /* - * At resume, start the snr poll thread only if it was suspended with - * the thread running. Extra care should be taken here, as some tuner - * status change might happen at resume time (for example, due to an - * ioctl syscall to set_frontend, or due to a release syscall). - */ - fe->ops.tuner_ops.get_status(fe, &tuner_status); - - if (tuner_status == TUNER_STATUS_LOCKED && - state->poll_snr_thread_restart) { - schedule_delayed_work(&state->poll_snr, - msecs_to_jiffies(POLL_THRD_TIME)); - - state->poll_snr_thread_restart = false; - } - - return 0; -} - /* * NOTE: * This is implemented here just to be used as an example for real @@ -375,9 +318,6 @@ static void vidtv_demod_release(struct dvb_frontend *fe) { struct vidtv_demod_state *state = fe->demodulator_priv; - if (state->poll_snr_thread_running) - cancel_delayed_work_sync(&state->poll_snr); - kfree(state); } @@ -423,9 +363,6 @@ static const struct dvb_frontend_ops vidtv_demod_ops = { .release = vidtv_demod_release, - .init = vidtv_demod_init, - .sleep = vidtv_demod_sleep, - .set_frontend = vidtv_demod_set_frontend, .get_frontend = vidtv_demod_get_frontend, @@ -461,8 +398,6 @@ static int vidtv_demod_i2c_probe(struct i2c_client *client, memcpy(&state->config, config, sizeof(state->config)); - INIT_DELAYED_WORK(&state->poll_snr, &vidtv_demod_poll_snr_handler); - state->frontend.demodulator_priv = state; i2c_set_clientdata(client, state); diff --git a/drivers/media/test-drivers/vidtv/vidtv_demod.h b/drivers/media/test-drivers/vidtv/vidtv_demod.h index 7f52a537935b..87651b0193e6 100644 --- a/drivers/media/test-drivers/vidtv/vidtv_demod.h +++ b/drivers/media/test-drivers/vidtv/vidtv_demod.h @@ -63,10 +63,7 @@ struct vidtv_demod_config { struct vidtv_demod_state { struct dvb_frontend frontend; struct vidtv_demod_config config; - struct delayed_work poll_snr; enum fe_status status; u16 tuner_cnr; - bool poll_snr_thread_running; - bool poll_snr_thread_restart; }; #endif // VIDTV_DEMOD_H