From patchwork Fri Jun 5 16:24:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 11590055 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C9A8A1391 for ; Fri, 5 Jun 2020 16:29:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B2862207D3 for ; Fri, 5 Jun 2020 16:29:30 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="PDO192MX" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726482AbgFEQ0A (ORCPT ); Fri, 5 Jun 2020 12:26:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40712 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726024AbgFEQZ7 (ORCPT ); Fri, 5 Jun 2020 12:25:59 -0400 Received: from mail-pj1-x1044.google.com (mail-pj1-x1044.google.com [IPv6:2607:f8b0:4864:20::1044]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 06634C08C5C2; Fri, 5 Jun 2020 09:25:59 -0700 (PDT) Received: by mail-pj1-x1044.google.com with SMTP id s88so2949204pjb.5; Fri, 05 Jun 2020 09:25:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=xiTMuwQ2X7Lvg1AXoObZHg8t385K8uvAl/6Z6GSCNRE=; b=PDO192MXtCEDH4yvw6uZfm77X6P4U22M7lARMan18YXz3iENPg4XxWelg81QrEsJpn kHAc5uecbkfIa/ZC5+sblLfe20Rfi5qKPaQWV9DvtjnAjFUgUA7lYWbj2QbLDeaiQk1I M2VCJgzSuHqbOb6ZJ3usaDMS04+Qi5vCcDWTtW1U/ksln2oZBSMMLnduaI5kOvnFf9z/ Dx/tcXUsEEPppj/9dwA5mhCnWukXJJv4NeYxxz5F3DpBHpayldKcn8202m0uhnKepd1h t2fWOo6Rbnjextv6pqkAslqz+AKHf9BFn5P2ac4EAq3x+feY/qQoc9leEjYyFeYi+SO1 2X6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=xiTMuwQ2X7Lvg1AXoObZHg8t385K8uvAl/6Z6GSCNRE=; b=uWgUYJzAMRnd9tRWz+Zilk731umoPhHwzk8Y5IXLtfGmeMPvyz069xdCCQYkxCoHoN 3TXWBCLqdh4C7aLtTnWrN1nee7C977Azi4Py8r459arP7ORnhGF3MrTndRBmOYKXuIVb o+m2EddMmPJ410CoTsBrWvYJNxCLDKrQoywJzfLON9BsV//EdTHWea1rvcPczUNmDHRG 1Pv1LO1J/5UlWQMxI1MxW+Q+6iLwiisTpy3Vf8zTcwTsceu6FJeb6Br3WFMz4xeIlSbS 3H/GJHh6F8OBY/8qo5N48R/BKKITShz1J/z+s7GduxuR0Lo9TuW9VNFmeanuQG/8tLAV y8XQ== X-Gm-Message-State: AOAM533cwmhDuolHO1UMFkkZ6n0syAVdC4L93qr7Q1Y0USO+zD2rqD8Q S7c4Eb5UpVcoCKpo8DMArM+LHE6P X-Google-Smtp-Source: ABdhPJzHxb4CKJjj1XbqGo+0bkVBi1f+HfoixTcES5XCnrpj/TQdExSyuo2+qImM8vYbsgYhRgeGVA== X-Received: by 2002:a17:90a:898a:: with SMTP id v10mr2269707pjn.95.1591374358118; Fri, 05 Jun 2020 09:25:58 -0700 (PDT) Received: from localhost.localdomain ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id b29sm86205pff.176.2020.06.05.09.25.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Jun 2020 09:25:57 -0700 (PDT) From: Florian Fainelli X-Google-Original-From: Florian Fainelli To: linux-kernel@vger.kernel.org Cc: stable@vger.kernel.org, Colin Ian King , Mauro Carvalho Chehab , Florian Fainelli , Mauro Carvalho Chehab , Michael Krufky , Alexander Viro , Shuah Khan , Jaedon Shin , Katsuhiro Suzuki , Satendra Singh Thakur , linux-media@vger.kernel.org (open list:MEDIA INPUT INFRASTRUCTURE (V4L/DVB)), linux-fsdevel@vger.kernel.org (open list:FILESYSTEMS (VFS and infrastructure)) Subject: [PATCH stable 4.9 01/21] media: dvb_frontend: ensure that inital front end status initialized Date: Fri, 5 Jun 2020 09:24:58 -0700 Message-Id: <20200605162518.28099-2-florian.fainelli@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200605162518.28099-1-florian.fainelli@broadcom.com> References: <20200605162518.28099-1-florian.fainelli@broadcom.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org From: Colin Ian King commit a9e4998073d49a762a154a6b48a332ec6cb8e6b1 upstream The fe_status variable s is not initialized meaning it can have any random garbage status. This could be problematic if fe->ops.tune is false as s is not updated by the call to fe->ops.tune() and a subsequent check on the change status will using a garbage value. Fix this by adding FE_NONE to the enum fe_status and initializing s to this. Detected by CoverityScan, CID#112887 ("Uninitialized scalar variable") Signed-off-by: Colin Ian King Reviewed-by: Shuah Khan Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Florian Fainelli --- drivers/media/dvb-core/dvb_frontend.c | 2 +- include/uapi/linux/dvb/frontend.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/media/dvb-core/dvb_frontend.c b/drivers/media/dvb-core/dvb_frontend.c index 2f054db8807b..372057cabea4 100644 --- a/drivers/media/dvb-core/dvb_frontend.c +++ b/drivers/media/dvb-core/dvb_frontend.c @@ -629,7 +629,7 @@ static int dvb_frontend_thread(void *data) struct dvb_frontend *fe = data; struct dtv_frontend_properties *c = &fe->dtv_property_cache; struct dvb_frontend_private *fepriv = fe->frontend_priv; - enum fe_status s; + enum fe_status s = FE_NONE; enum dvbfe_algo algo; bool re_tune = false; bool semheld = false; diff --git a/include/uapi/linux/dvb/frontend.h b/include/uapi/linux/dvb/frontend.h index 00a20cd21ee2..afc3972b0879 100644 --- a/include/uapi/linux/dvb/frontend.h +++ b/include/uapi/linux/dvb/frontend.h @@ -127,6 +127,7 @@ enum fe_sec_mini_cmd { * to reset DiSEqC, tone and parameters */ enum fe_status { + FE_NONE = 0x00, FE_HAS_SIGNAL = 0x01, FE_HAS_CARRIER = 0x02, FE_HAS_VITERBI = 0x04, From patchwork Fri Jun 5 16:24:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 11590051 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D8CFB618 for ; Fri, 5 Jun 2020 16:29:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C26B3207ED for ; Fri, 5 Jun 2020 16:29:28 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="sTwJSvUc" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726748AbgFEQ0C (ORCPT ); Fri, 5 Jun 2020 12:26:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40718 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726727AbgFEQ0B (ORCPT ); Fri, 5 Jun 2020 12:26:01 -0400 Received: from mail-pg1-x543.google.com (mail-pg1-x543.google.com [IPv6:2607:f8b0:4864:20::543]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2D3B2C08C5C2; Fri, 5 Jun 2020 09:26:01 -0700 (PDT) Received: by mail-pg1-x543.google.com with SMTP id o6so5377104pgh.2; Fri, 05 Jun 2020 09:26:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=FrKureXAugTznm0BDZd4QZA9eNgJhwIv0PlSXJOT72U=; b=sTwJSvUcQ20+52QuZlahVZ/PtgEVkSBVPfH530tFTp29oZT9wXxczb8OHoQU8iS0pN PSdp+BHmPkExZqmwEdgmyOpz7JgFI1CbCT8HQKSrG21QIMe4qYettibVCVjlmh2vmlVp 570ZeirjE28Zo41IQk0XELbF4SeVkGf7gTmTNOt+UrMdLt47PFw32aPo1/JrMx5+/3c7 AhBLnwoCz6GGp7gt/mFR6XL65PLfWOr002c9xWkqRxPDRTJuGfwd3JyWpLxyfq+bctPi m4RsGMZ+NWtHITvNy17FEgOcyzoCYScKnh3z9nfM/7SrC9EMgvdCyj9awU1zVCVhR2iy j55g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=FrKureXAugTznm0BDZd4QZA9eNgJhwIv0PlSXJOT72U=; b=ovRBnLB/R924eIijJRGESn9b+giNlAkHdkyFwqFYbrdt6OGZKK/k1P7lxt6JK8I2Dw t8wOVjy63fOYTcOoHUFAQXw1lVEYE42ftQXbLLW7MWHSFwOCchj+f7UxogpVqSiQ04tD WBwKLbW+nhiOXF4xwkm8iNlw+UNMLSdvZFGsVNPZnoiCm7ywstSQRN6NkK9v8sVd9YeA 3frUVfbdAiHzbIIwpd1xtzG4J67OcW20gKDH/x0RF8UfT1eklW4EKXFMiDtDYsN5Uqy/ P5KNc4F6tYbhQCj/g6tzo6Cje1VW/6NNRb4T5mUApBZONpRVjTxNtih0LIEpL+Yznp+E rU3g== X-Gm-Message-State: AOAM530Q2O40p0bkIN9idn5WdFwzLFTnHuuWRYIPu0Mc59IdwUf80BLu 0PLpXZNtA9ey1FHU25XT+XePepSE X-Google-Smtp-Source: ABdhPJzr7d6bll/CqwR+jW9s0alK40zPfr3i3/ktdsLPzXYazAPQVp5BJfS0dLJEvvs1FhpQRG/BoQ== X-Received: by 2002:aa7:95bd:: with SMTP id a29mr10340370pfk.57.1591374360329; Fri, 05 Jun 2020 09:26:00 -0700 (PDT) Received: from localhost.localdomain ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id b29sm86205pff.176.2020.06.05.09.25.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Jun 2020 09:25:59 -0700 (PDT) From: Florian Fainelli X-Google-Original-From: Florian Fainelli To: linux-kernel@vger.kernel.org Cc: stable@vger.kernel.org, Colin Ian King , Mauro Carvalho Chehab , Florian Fainelli , Mauro Carvalho Chehab , Michael Krufky , Alexander Viro , Shuah Khan , Jaedon Shin , Katsuhiro Suzuki , Satendra Singh Thakur , linux-media@vger.kernel.org (open list:MEDIA INPUT INFRASTRUCTURE (V4L/DVB)), linux-fsdevel@vger.kernel.org (open list:FILESYSTEMS (VFS and infrastructure)) Subject: [PATCH stable 4.9 02/21] media: dvb_frontend: initialize variable s with FE_NONE instead of 0 Date: Fri, 5 Jun 2020 09:24:59 -0700 Message-Id: <20200605162518.28099-3-florian.fainelli@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200605162518.28099-1-florian.fainelli@broadcom.com> References: <20200605162518.28099-1-florian.fainelli@broadcom.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org From: Colin Ian King commit 450694c3b9f47b826a002089c463b9454b4bbe42 upstream GIT_AUTHOR_NAME=Colin King GIT_AUTHOR_EMAIL=colin.king@canonical.com In a previous commit, we added FE_NONE as an unknown fe_status. Initialize variable s to FE_NONE instead of the more opaque value 0. Signed-off-by: Colin Ian King Reviewed-by: Shuah Khan Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Florian Fainelli --- drivers/media/dvb-core/dvb_frontend.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/dvb-core/dvb_frontend.c b/drivers/media/dvb-core/dvb_frontend.c index 372057cabea4..3b045298546c 100644 --- a/drivers/media/dvb-core/dvb_frontend.c +++ b/drivers/media/dvb-core/dvb_frontend.c @@ -458,7 +458,7 @@ static int dvb_frontend_swzigzag_autotune(struct dvb_frontend *fe, int check_wra static void dvb_frontend_swzigzag(struct dvb_frontend *fe) { - enum fe_status s = 0; + enum fe_status s = FE_NONE; int retval = 0; struct dvb_frontend_private *fepriv = fe->frontend_priv; struct dtv_frontend_properties *c = &fe->dtv_property_cache, tmp; From patchwork Fri Jun 5 16:25:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 11590049 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5C1E3618 for ; Fri, 5 Jun 2020 16:29:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3BB7C207D8 for ; Fri, 5 Jun 2020 16:29:27 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="o1Y+Lg9G" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726954AbgFEQ0H (ORCPT ); Fri, 5 Jun 2020 12:26:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40728 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726931AbgFEQ0E (ORCPT ); Fri, 5 Jun 2020 12:26:04 -0400 Received: from mail-pl1-x642.google.com (mail-pl1-x642.google.com [IPv6:2607:f8b0:4864:20::642]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 608A7C08C5C2; Fri, 5 Jun 2020 09:26:03 -0700 (PDT) Received: by mail-pl1-x642.google.com with SMTP id m7so3833905plt.5; Fri, 05 Jun 2020 09:26:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=BK5uIPuoj5s3p1umbZFHQonWFQu9J5ojGIynUIx7wUM=; b=o1Y+Lg9GRJIjG8s92hys4u8VNy2FlWfVhj8RIt0DPU3v3vU+fXtiAJ5b10Eclt8AdI ekQWzGhmugOXdsdgn6RUO4hVXR3RxzroXWol58QZdgDTuutR2RRGPdY3h7D5qnDvJgbm DSqjMPkeYbW/1A6BXjpxtGrDTKn47GRT5uXE+8XKsRaYZb06Hv2fq5WyWoWknqSXr3AC UTPKncETIZuSVAeYvtIKDKLj+NuL/52UNUdXkGg1JvFBk0TC6igA665USAll5lxKiFPl pWyu/9FPvuMwWjzX3JkTt/raS/PiH/BbQ00tTnOZspvRrvac4YI94xg0AuOrI2KAbSyw e8yQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=BK5uIPuoj5s3p1umbZFHQonWFQu9J5ojGIynUIx7wUM=; b=WnK5KWw9boUK69X4nkslw2Va1zVjyyEjCajVXcQCVXP6sRyBw+ux+dsxeXA5Sb8Mb2 dUh16KjVV/G4qEr2U9g/UFpjN1LGujt/ixlmoGvGpz2ME7LP5eULZ4gpEVHsoih/lKwG ln1FqzrnEe83nxjYVDgiX3yUFDW2MV+BOEeeg6+Gnypc6Dd56BBaI6kHZ94jEzEGzXLk bdnVJkp3SHtrPeffQvUDxWyEixc9w98rgT3nqZUAmQPc9VbkCkvX9qSSiHQ//hs26+M7 6bdTBK4xnmDdFnb5FDHWg5DWHRl6hlK81C/lr8NozCEHD8wm7U5BJuy44DmtdwePfvJl rahA== X-Gm-Message-State: AOAM533pBwSdPDZI7KpvXEBJ2c1ZCGIzyjsYRKqSF82VwFr7Z7k2vGSx LLl32BWJSdwuMREiob8uC8ADsk4p X-Google-Smtp-Source: ABdhPJxoA8r8XBGDgg/yFx4eRcKgWc49CV2edBLecXIp/5z5xiHV048E+xGGFOBu5mDQDVHIPKoxQg== X-Received: by 2002:a17:902:a505:: with SMTP id s5mr10619204plq.20.1591374362435; Fri, 05 Jun 2020 09:26:02 -0700 (PDT) Received: from localhost.localdomain ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id b29sm86205pff.176.2020.06.05.09.26.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Jun 2020 09:26:01 -0700 (PDT) From: Florian Fainelli X-Google-Original-From: Florian Fainelli To: linux-kernel@vger.kernel.org Cc: stable@vger.kernel.org, Mauro Carvalho Chehab , Florian Fainelli , Mauro Carvalho Chehab , Michael Krufky , Alexander Viro , Shuah Khan , Jaedon Shin , Colin Ian King , Katsuhiro Suzuki , Satendra Singh Thakur , linux-media@vger.kernel.org (open list:MEDIA INPUT INFRASTRUCTURE (V4L/DVB)), linux-fsdevel@vger.kernel.org (open list:FILESYSTEMS (VFS and infrastructure)) Subject: [PATCH stable 4.9 03/21] media: dvb/frontend.h: move out a private internal structure Date: Fri, 5 Jun 2020 09:25:00 -0700 Message-Id: <20200605162518.28099-4-florian.fainelli@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200605162518.28099-1-florian.fainelli@broadcom.com> References: <20200605162518.28099-1-florian.fainelli@broadcom.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org From: Mauro Carvalho Chehab commit f35afa4f60c868d7c7811ba747133acbf39410ac upstream struct dtv_cmds_h is just an ancillary struct used by the dvb_frontend.c to internally store frontend commands. It doesn't belong to the userspace header, nor it is used anywhere, except inside the DVB core. So, remove it from the header. Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Florian Fainelli --- drivers/media/dvb-core/dvb_frontend.c | 11 +++++++++++ include/uapi/linux/dvb/frontend.h | 11 ----------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/drivers/media/dvb-core/dvb_frontend.c b/drivers/media/dvb-core/dvb_frontend.c index 3b045298546c..7eeb5d302c9c 100644 --- a/drivers/media/dvb-core/dvb_frontend.c +++ b/drivers/media/dvb-core/dvb_frontend.c @@ -998,6 +998,17 @@ static int dvb_frontend_clear_cache(struct dvb_frontend *fe) .buffer = b \ } +struct dtv_cmds_h { + char *name; /* A display name for debugging purposes */ + + __u32 cmd; /* A unique ID */ + + /* Flags */ + __u32 set:1; /* Either a set or get property */ + __u32 buffer:1; /* Does this property use the buffer? */ + __u32 reserved:30; /* Align */ +}; + static struct dtv_cmds_h dtv_cmds[DTV_MAX_COMMAND + 1] = { _DTV_CMD(DTV_TUNE, 1, 0), _DTV_CMD(DTV_CLEAR, 1, 0), diff --git a/include/uapi/linux/dvb/frontend.h b/include/uapi/linux/dvb/frontend.h index afc3972b0879..3a80f3d1da1c 100644 --- a/include/uapi/linux/dvb/frontend.h +++ b/include/uapi/linux/dvb/frontend.h @@ -384,17 +384,6 @@ enum atscmh_rs_code_mode { #define NO_STREAM_ID_FILTER (~0U) #define LNA_AUTO (~0U) -struct dtv_cmds_h { - char *name; /* A display name for debugging purposes */ - - __u32 cmd; /* A unique ID */ - - /* Flags */ - __u32 set:1; /* Either a set or get property */ - __u32 buffer:1; /* Does this property use the buffer? */ - __u32 reserved:30; /* Align */ -}; - /** * Scale types for the quality parameters. * @FE_SCALE_NOT_AVAILABLE: That QoS measure is not available. That From patchwork Fri Jun 5 16:25:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 11590045 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 96358913 for ; Fri, 5 Jun 2020 16:29:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6B345207D3 for ; Fri, 5 Jun 2020 16:29:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="shQeDJby" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726993AbgFEQ0I (ORCPT ); Fri, 5 Jun 2020 12:26:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40738 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726727AbgFEQ0G (ORCPT ); Fri, 5 Jun 2020 12:26:06 -0400 Received: from mail-pg1-x543.google.com (mail-pg1-x543.google.com [IPv6:2607:f8b0:4864:20::543]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4B55BC08C5C3; Fri, 5 Jun 2020 09:26:06 -0700 (PDT) Received: by mail-pg1-x543.google.com with SMTP id n23so5323538pgb.12; Fri, 05 Jun 2020 09:26:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=gK4EYEuA1xQYKu5kUOd5FUTkj25yj2mfT5FJcYWK+3k=; b=shQeDJbyBfYTp3M9bbw2EB+8hexYYa1PSlBnVP43nt0rnKe1as396LqArd0IxDQ6Kx X2QoblKPpYyRtx2kyNF1ApNc4MEfrOOMsm4Ffu/5wK+J2vXH3swUnXAGrafZUcq7HRCo FQGyh28SocI1ZS9ut5GCv8ZnO3VdvEPBJbuhY+0ZCKBPsgnvSXSG3s3BpVFC1lQB2fYP gajy0Mzz7cPwq++fNj7FeajR6CWOSkmM5TiAlwyqVyBgsO3/n7p2GchbgnLe7/ik1wil 2wF8yq/qElLaizPlFYiXWADIIBT/uaqg6w06iYW8QOUQn+SCkkB9s3YawHbyld/sSw+r zvBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=gK4EYEuA1xQYKu5kUOd5FUTkj25yj2mfT5FJcYWK+3k=; b=VW7uhwdYZUSCAVr2KzSSzFhcsJcgGccgdmPr5XgwjkvJgl0aZS0Fo5TPuskFY1eoCS CYJJlshLlEHxjPB2fmuSwCq7UYUl8K4Y6ScGZabx5OnKrFBJB1jQJkrbcHAFbNhjBC57 +i3JXN7z5OFbsdVCQUUkYKxt+AoUhPD3SM3rHOzjbZGbaxA1YAmMTbSlAqaSg2tYK/j5 cJRyxo2iqM9ctrXqXyWxuXpeXTMZTYxM8QwaRlOyEntumvMujqrZD98uqWJ/cQasE1Da IJ+W6BvyRpCJMV6NNYBdPxhNFeeQUfYUehObaRhVmM6GN2vhanJsHhsKDlfATfO44llA NpCQ== X-Gm-Message-State: AOAM531xqi4QTcPha1dyjeVraDmCAKd0vOJiudfnHGof9jexO4DSAAMv Q4bMp0jZ+CoxbpcikgtBfMTQttWn X-Google-Smtp-Source: ABdhPJwZzxc3j+7RJHfL1P9YMGbog7zdwEvmseiavKsXgvzzt2iZpzwJXYNICXBcT9a2w5QOQI+v7w== X-Received: by 2002:a62:8cca:: with SMTP id m193mr6953957pfd.308.1591374364755; Fri, 05 Jun 2020 09:26:04 -0700 (PDT) Received: from localhost.localdomain ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id b29sm86205pff.176.2020.06.05.09.26.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Jun 2020 09:26:03 -0700 (PDT) From: Florian Fainelli X-Google-Original-From: Florian Fainelli To: linux-kernel@vger.kernel.org Cc: stable@vger.kernel.org, Mauro Carvalho Chehab , Florian Fainelli , Mauro Carvalho Chehab , Michael Krufky , Alexander Viro , Shuah Khan , Jaedon Shin , Colin Ian King , Katsuhiro Suzuki , Satendra Singh Thakur , linux-media@vger.kernel.org (open list:MEDIA INPUT INFRASTRUCTURE (V4L/DVB)), linux-fsdevel@vger.kernel.org (open list:FILESYSTEMS (VFS and infrastructure)) Subject: [PATCH stable 4.9 04/21] media: dvb/frontend.h: document the uAPI file Date: Fri, 5 Jun 2020 09:25:01 -0700 Message-Id: <20200605162518.28099-5-florian.fainelli@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200605162518.28099-1-florian.fainelli@broadcom.com> References: <20200605162518.28099-1-florian.fainelli@broadcom.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org From: Mauro Carvalho Chehab commit 8220ead805b6bab4ade2839857a198e9708b07de upstream Most of the stuff at the Digital TV frontend header file are documented only at the Documentation. However, a few kernel-doc markups are there, several of them with parsing issues. Add the missing documentation, copying definitions from the Documentation when it applies, fixing some bugs. Please notice that DVBv3 stuff that were deprecated weren't commented by purpose. Instead, they were clearly tagged as such. This patch prepares to move part of the documentation from Documentation/ to kernel-doc comments. Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Florian Fainelli --- include/uapi/linux/dvb/frontend.h | 580 +++++++++++++++++++++++++----- 1 file changed, 498 insertions(+), 82 deletions(-) diff --git a/include/uapi/linux/dvb/frontend.h b/include/uapi/linux/dvb/frontend.h index 3a80f3d1da1c..16a318fc469a 100644 --- a/include/uapi/linux/dvb/frontend.h +++ b/include/uapi/linux/dvb/frontend.h @@ -28,13 +28,46 @@ #include -enum fe_type { - FE_QPSK, - FE_QAM, - FE_OFDM, - FE_ATSC -}; - +/** + * enum fe_caps - Frontend capabilities + * + * @FE_IS_STUPID: There's something wrong at the + * frontend, and it can't report its + * capabilities. + * @FE_CAN_INVERSION_AUTO: Can auto-detect frequency spectral + * band inversion + * @FE_CAN_FEC_1_2: Supports FEC 1/2 + * @FE_CAN_FEC_2_3: Supports FEC 2/3 + * @FE_CAN_FEC_3_4: Supports FEC 3/4 + * @FE_CAN_FEC_4_5: Supports FEC 4/5 + * @FE_CAN_FEC_5_6: Supports FEC 5/6 + * @FE_CAN_FEC_6_7: Supports FEC 6/7 + * @FE_CAN_FEC_7_8: Supports FEC 7/8 + * @FE_CAN_FEC_8_9: Supports FEC 8/9 + * @FE_CAN_FEC_AUTO: Can auto-detect FEC + * @FE_CAN_QPSK: Supports QPSK modulation + * @FE_CAN_QAM_16: Supports 16-QAM modulation + * @FE_CAN_QAM_32: Supports 32-QAM modulation + * @FE_CAN_QAM_64: Supports 64-QAM modulation + * @FE_CAN_QAM_128: Supports 128-QAM modulation + * @FE_CAN_QAM_256: Supports 256-QAM modulation + * @FE_CAN_QAM_AUTO: Can auto-detect QAM modulation + * @FE_CAN_TRANSMISSION_MODE_AUTO: Can auto-detect transmission mode + * @FE_CAN_BANDWIDTH_AUTO: Can auto-detect bandwidth + * @FE_CAN_GUARD_INTERVAL_AUTO: Can auto-detect guard interval + * @FE_CAN_HIERARCHY_AUTO: Can auto-detect hierarchy + * @FE_CAN_8VSB: Supports 8-VSB modulation + * @FE_CAN_16VSB: Supporta 16-VSB modulation + * @FE_HAS_EXTENDED_CAPS: Unused + * @FE_CAN_MULTISTREAM: Supports multistream filtering + * @FE_CAN_TURBO_FEC: Supports "turbo FEC" modulation + * @FE_CAN_2G_MODULATION: Supports "2nd generation" modulation, + * e. g. DVB-S2, DVB-T2, DVB-C2 + * @FE_NEEDS_BENDING: Unused + * @FE_CAN_RECOVER: Can recover from a cable unplug + * automatically + * @FE_CAN_MUTE_TS: Can stop spurious TS data output + */ enum fe_caps { FE_IS_STUPID = 0, FE_CAN_INVERSION_AUTO = 0x1, @@ -60,15 +93,55 @@ enum fe_caps { FE_CAN_HIERARCHY_AUTO = 0x100000, FE_CAN_8VSB = 0x200000, FE_CAN_16VSB = 0x400000, - FE_HAS_EXTENDED_CAPS = 0x800000, /* We need more bitspace for newer APIs, indicate this. */ - FE_CAN_MULTISTREAM = 0x4000000, /* frontend supports multistream filtering */ - FE_CAN_TURBO_FEC = 0x8000000, /* frontend supports "turbo fec modulation" */ - FE_CAN_2G_MODULATION = 0x10000000, /* frontend supports "2nd generation modulation" (DVB-S2) */ - FE_NEEDS_BENDING = 0x20000000, /* not supported anymore, don't use (frontend requires frequency bending) */ - FE_CAN_RECOVER = 0x40000000, /* frontend can recover from a cable unplug automatically */ - FE_CAN_MUTE_TS = 0x80000000 /* frontend can stop spurious TS data output */ + FE_HAS_EXTENDED_CAPS = 0x800000, + FE_CAN_MULTISTREAM = 0x4000000, + FE_CAN_TURBO_FEC = 0x8000000, + FE_CAN_2G_MODULATION = 0x10000000, + FE_NEEDS_BENDING = 0x20000000, + FE_CAN_RECOVER = 0x40000000, + FE_CAN_MUTE_TS = 0x80000000 +}; + +/* + * DEPRECATED: Should be kept just due to backward compatibility. + */ +enum fe_type { + FE_QPSK, + FE_QAM, + FE_OFDM, + FE_ATSC }; +/** + * struct dvb_frontend_info - Frontend properties and capabilities + * + * @name: Name of the frontend + * @type: **DEPRECATED**. + * Should not be used on modern programs, + * as a frontend may have more than one type. + * In order to get the support types of a given + * frontend, use :c:type:`DTV_ENUM_DELSYS` + * instead. + * @frequency_min: Minimal frequency supported by the frontend. + * @frequency_max: Minimal frequency supported by the frontend. + * @frequency_stepsize: All frequencies are multiple of this value. + * @frequency_tolerance: Frequency tolerance. + * @symbol_rate_min: Minimal symbol rate, in bauds + * (for Cable/Satellite systems). + * @symbol_rate_max: Maximal symbol rate, in bauds + * (for Cable/Satellite systems). + * @symbol_rate_tolerance: Maximal symbol rate tolerance, in ppm + * (for Cable/Satellite systems). + * @notifier_delay: **DEPRECATED**. Not used by any driver. + * @caps: Capabilities supported by the frontend, + * as specified in &enum fe_caps. + * + * .. note: + * + * #. The frequencies are specified in Hz for Terrestrial and Cable + * systems. + * #. The frequencies are specified in kHz for Satellite systems. + */ struct dvb_frontend_info { char name[128]; enum fe_type type; /* DEPRECATED. Use DTV_ENUM_DELSYS instead */ @@ -78,53 +151,102 @@ struct dvb_frontend_info { __u32 frequency_tolerance; __u32 symbol_rate_min; __u32 symbol_rate_max; - __u32 symbol_rate_tolerance; /* ppm */ + __u32 symbol_rate_tolerance; __u32 notifier_delay; /* DEPRECATED */ enum fe_caps caps; }; - /** - * Check out the DiSEqC bus spec available on http://www.eutelsat.org/ for - * the meaning of this struct... + * struct dvb_diseqc_master_cmd - DiSEqC master command + * + * @msg: + * DiSEqC message to be sent. It contains a 3 bytes header with: + * framing + address + command, and an optional argument + * of up to 3 bytes of data. + * @msg_len: + * Length of the DiSEqC message. Valid values are 3 to 6. + * + * Check out the DiSEqC bus spec available on http://www.eutelsat.org/ for + * the possible messages that can be used. */ struct dvb_diseqc_master_cmd { - __u8 msg [6]; /* { framing, address, command, data [3] } */ - __u8 msg_len; /* valid values are 3...6 */ + __u8 msg[6]; + __u8 msg_len; }; +/** + * struct dvb_diseqc_slave_reply - DiSEqC received data + * + * @msg: + * DiSEqC message buffer to store a message received via DiSEqC. + * It contains one byte header with: framing and + * an optional argument of up to 3 bytes of data. + * @msg_len: + * Length of the DiSEqC message. Valid values are 0 to 4, + * where 0 means no message. + * @timeout: + * Return from ioctl after timeout ms with errorcode when + * no message was received. + * + * Check out the DiSEqC bus spec available on http://www.eutelsat.org/ for + * the possible messages that can be used. + */ struct dvb_diseqc_slave_reply { - __u8 msg [4]; /* { framing, data [3] } */ - __u8 msg_len; /* valid values are 0...4, 0 means no msg */ - int timeout; /* return from ioctl after timeout ms with */ -}; /* errorcode when no message was received */ + __u8 msg[4]; + __u8 msg_len; + int timeout; +}; +/** + * enum fe_sec_voltage - DC Voltage used to feed the LNBf + * + * @SEC_VOLTAGE_13: Output 13V to the LNBf + * @SEC_VOLTAGE_18: Output 18V to the LNBf + * @SEC_VOLTAGE_OFF: Don't feed the LNBf with a DC voltage + */ enum fe_sec_voltage { SEC_VOLTAGE_13, SEC_VOLTAGE_18, SEC_VOLTAGE_OFF }; +/** + * enum fe_sec_tone_mode - Type of tone to be send to the LNBf. + * @SEC_TONE_ON: Sends a 22kHz tone burst to the antenna. + * @SEC_TONE_OFF: Don't send a 22kHz tone to the antenna (except + * if the ``FE_DISEQC_*`` ioctls are called). + */ enum fe_sec_tone_mode { SEC_TONE_ON, SEC_TONE_OFF }; +/** + * enum fe_sec_mini_cmd - Type of mini burst to be sent + * + * @SEC_MINI_A: Sends a mini-DiSEqC 22kHz '0' Tone Burst to select + * satellite-A + * @SEC_MINI_B: Sends a mini-DiSEqC 22kHz '1' Data Burst to select + * satellite-B + */ enum fe_sec_mini_cmd { SEC_MINI_A, SEC_MINI_B }; /** - * enum fe_status - enumerates the possible frontend status - * @FE_HAS_SIGNAL: found something above the noise level - * @FE_HAS_CARRIER: found a DVB signal - * @FE_HAS_VITERBI: FEC is stable - * @FE_HAS_SYNC: found sync bytes - * @FE_HAS_LOCK: everything's working - * @FE_TIMEDOUT: no lock within the last ~2 seconds - * @FE_REINIT: frontend was reinitialized, application is recommended - * to reset DiSEqC, tone and parameters + * enum fe_status - Enumerates the possible frontend status. + * @FE_NONE: The frontend doesn't have any kind of lock. + * That's the initial frontend status + * @FE_HAS_SIGNAL: Has found something above the noise level. + * @FE_HAS_CARRIER: Has found a DVB signal. + * @FE_HAS_VITERBI: FEC inner coding (Viterbi, LDPC or other inner code). + * is stable. + * @FE_HAS_SYNC: Synchronization bytes was found. + * @FE_HAS_LOCK: DVB were locked and everything is working. + * @FE_TIMEDOUT: Fo lock within the last about 2 seconds. + * @FE_REINIT: Frontend was reinitialized, application is recommended + * to reset DiSEqC, tone and parameters. */ enum fe_status { FE_NONE = 0x00, @@ -137,12 +259,45 @@ enum fe_status { FE_REINIT = 0x40, }; +/** + * enum fe_spectral_inversion - Type of inversion band + * + * @INVERSION_OFF: Don't do spectral band inversion. + * @INVERSION_ON: Do spectral band inversion. + * @INVERSION_AUTO: Autodetect spectral band inversion. + * + * This parameter indicates if spectral inversion should be presumed or + * not. In the automatic setting (``INVERSION_AUTO``) the hardware will try + * to figure out the correct setting by itself. If the hardware doesn't + * support, the DVB core will try to lock at the carrier first with + * inversion off. If it fails, it will try to enable inversion. + */ enum fe_spectral_inversion { INVERSION_OFF, INVERSION_ON, INVERSION_AUTO }; +/** + * enum fe_code_rate - Type of Forward Error Correction (FEC) + * + * + * @FEC_NONE: No Forward Error Correction Code + * @FEC_1_2: Forward Error Correction Code 1/2 + * @FEC_2_3: Forward Error Correction Code 2/3 + * @FEC_3_4: Forward Error Correction Code 3/4 + * @FEC_4_5: Forward Error Correction Code 4/5 + * @FEC_5_6: Forward Error Correction Code 5/6 + * @FEC_6_7: Forward Error Correction Code 6/7 + * @FEC_7_8: Forward Error Correction Code 7/8 + * @FEC_8_9: Forward Error Correction Code 8/9 + * @FEC_AUTO: Autodetect Error Correction Code + * @FEC_3_5: Forward Error Correction Code 3/5 + * @FEC_9_10: Forward Error Correction Code 9/10 + * @FEC_2_5: Forward Error Correction Code 2/5 + * + * Please note that not all FEC types are supported by a given standard. + */ enum fe_code_rate { FEC_NONE = 0, FEC_1_2, @@ -159,6 +314,26 @@ enum fe_code_rate { FEC_2_5, }; +/** + * enum fe_modulation - Type of modulation/constellation + * @QPSK: QPSK modulation + * @QAM_16: 16-QAM modulation + * @QAM_32: 32-QAM modulation + * @QAM_64: 64-QAM modulation + * @QAM_128: 128-QAM modulation + * @QAM_256: 256-QAM modulation + * @QAM_AUTO: Autodetect QAM modulation + * @VSB_8: 8-VSB modulation + * @VSB_16: 16-VSB modulation + * @PSK_8: 8-PSK modulation + * @APSK_16: 16-APSK modulation + * @APSK_32: 32-APSK modulation + * @DQPSK: DQPSK modulation + * @QAM_4_NR: 4-QAM-NR modulation + * + * Please note that not all modulations are supported by a given standard. + * + */ enum fe_modulation { QPSK, QAM_16, @@ -176,6 +351,32 @@ enum fe_modulation { QAM_4_NR, }; +/** + * enum fe_transmit_mode - Transmission mode + * + * @TRANSMISSION_MODE_AUTO: + * Autodetect transmission mode. The hardware will try to find the + * correct FFT-size (if capable) to fill in the missing parameters. + * @TRANSMISSION_MODE_1K: + * Transmission mode 1K + * @TRANSMISSION_MODE_2K: + * Transmission mode 2K + * @TRANSMISSION_MODE_8K: + * Transmission mode 8K + * @TRANSMISSION_MODE_4K: + * Transmission mode 4K + * @TRANSMISSION_MODE_16K: + * Transmission mode 16K + * @TRANSMISSION_MODE_32K: + * Transmission mode 32K + * @TRANSMISSION_MODE_C1: + * Single Carrier (C=1) transmission mode (DTMB only) + * @TRANSMISSION_MODE_C3780: + * Multi Carrier (C=3780) transmission mode (DTMB only) + * + * Please note that not all transmission modes are supported by a given + * standard. + */ enum fe_transmit_mode { TRANSMISSION_MODE_2K, TRANSMISSION_MODE_8K, @@ -188,6 +389,23 @@ enum fe_transmit_mode { TRANSMISSION_MODE_C3780, }; +/** + * enum fe_guard_interval - Guard interval + * + * @GUARD_INTERVAL_AUTO: Autodetect the guard interval + * @GUARD_INTERVAL_1_128: Guard interval 1/128 + * @GUARD_INTERVAL_1_32: Guard interval 1/32 + * @GUARD_INTERVAL_1_16: Guard interval 1/16 + * @GUARD_INTERVAL_1_8: Guard interval 1/8 + * @GUARD_INTERVAL_1_4: Guard interval 1/4 + * @GUARD_INTERVAL_19_128: Guard interval 19/128 + * @GUARD_INTERVAL_19_256: Guard interval 19/256 + * @GUARD_INTERVAL_PN420: PN length 420 (1/4) + * @GUARD_INTERVAL_PN595: PN length 595 (1/6) + * @GUARD_INTERVAL_PN945: PN length 945 (1/9) + * + * Please note that not all guard intervals are supported by a given standard. + */ enum fe_guard_interval { GUARD_INTERVAL_1_32, GUARD_INTERVAL_1_16, @@ -202,6 +420,16 @@ enum fe_guard_interval { GUARD_INTERVAL_PN945, }; +/** + * enum fe_hierarchy - Hierarchy + * @HIERARCHY_NONE: No hierarchy + * @HIERARCHY_AUTO: Autodetect hierarchy (if supported) + * @HIERARCHY_1: Hierarchy 1 + * @HIERARCHY_2: Hierarchy 2 + * @HIERARCHY_4: Hierarchy 4 + * + * Please note that not all hierarchy types are supported by a given standard. + */ enum fe_hierarchy { HIERARCHY_NONE, HIERARCHY_1, @@ -210,6 +438,15 @@ enum fe_hierarchy { HIERARCHY_AUTO }; +/** + * enum fe_interleaving - Interleaving + * @INTERLEAVING_NONE: No interleaving. + * @INTERLEAVING_AUTO: Auto-detect interleaving. + * @INTERLEAVING_240: Interleaving of 240 symbols. + * @INTERLEAVING_720: Interleaving of 720 symbols. + * + * Please note that, currently, only DTMB uses it. + */ enum fe_interleaving { INTERLEAVING_NONE, INTERLEAVING_AUTO, @@ -217,7 +454,8 @@ enum fe_interleaving { INTERLEAVING_720, }; -/* S2API Commands */ +/* DVBv5 property Commands */ + #define DTV_UNDEFINED 0 #define DTV_TUNE 1 #define DTV_CLEAR 2 @@ -310,19 +548,79 @@ enum fe_interleaving { #define DTV_MAX_COMMAND DTV_STAT_TOTAL_BLOCK_COUNT +/** + * enum fe_pilot - Type of pilot tone + * + * @PILOT_ON: Pilot tones enabled + * @PILOT_OFF: Pilot tones disabled + * @PILOT_AUTO: Autodetect pilot tones + */ enum fe_pilot { PILOT_ON, PILOT_OFF, PILOT_AUTO, }; +/** + * enum fe_rolloff - Rolloff factor (also known as alpha) + * @ROLLOFF_35: Roloff factor: 35% + * @ROLLOFF_20: Roloff factor: 20% + * @ROLLOFF_25: Roloff factor: 25% + * @ROLLOFF_AUTO: Auto-detect the roloff factor. + * + * .. note: + * + * Roloff factor of 35% is implied on DVB-S. On DVB-S2, it is default. + */ enum fe_rolloff { - ROLLOFF_35, /* Implied value in DVB-S, default for DVB-S2 */ + ROLLOFF_35, ROLLOFF_20, ROLLOFF_25, ROLLOFF_AUTO, }; +/** + * enum fe_delivery_system - Type of the delivery system + * + * @SYS_UNDEFINED: + * Undefined standard. Generally, indicates an error + * @SYS_DVBC_ANNEX_A: + * Cable TV: DVB-C following ITU-T J.83 Annex A spec + * @SYS_DVBC_ANNEX_B: + * Cable TV: DVB-C following ITU-T J.83 Annex B spec (ClearQAM) + * @SYS_DVBC_ANNEX_C: + * Cable TV: DVB-C following ITU-T J.83 Annex C spec + * @SYS_ISDBC: + * Cable TV: ISDB-C (no drivers yet) + * @SYS_DVBT: + * Terrestrial TV: DVB-T + * @SYS_DVBT2: + * Terrestrial TV: DVB-T2 + * @SYS_ISDBT: + * Terrestrial TV: ISDB-T + * @SYS_ATSC: + * Terrestrial TV: ATSC + * @SYS_ATSCMH: + * Terrestrial TV (mobile): ATSC-M/H + * @SYS_DTMB: + * Terrestrial TV: DTMB + * @SYS_DVBS: + * Satellite TV: DVB-S + * @SYS_DVBS2: + * Satellite TV: DVB-S2 + * @SYS_TURBO: + * Satellite TV: DVB-S Turbo + * @SYS_ISDBS: + * Satellite TV: ISDB-S + * @SYS_DAB: + * Digital audio: DAB (not fully supported) + * @SYS_DSS: + * Satellite TV: DSS (not fully supported) + * @SYS_CMMB: + * Terrestrial TV (mobile): CMMB (not fully supported) + * @SYS_DVBH: + * Terrestrial TV (mobile): DVB-H (standard deprecated) + */ enum fe_delivery_system { SYS_UNDEFINED, SYS_DVBC_ANNEX_A, @@ -345,35 +643,85 @@ enum fe_delivery_system { SYS_DVBC_ANNEX_C, }; -/* backward compatibility */ +/* backward compatibility definitions for delivery systems */ #define SYS_DVBC_ANNEX_AC SYS_DVBC_ANNEX_A -#define SYS_DMBTH SYS_DTMB /* DMB-TH is legacy name, use DTMB instead */ +#define SYS_DMBTH SYS_DTMB /* DMB-TH is legacy name, use DTMB */ -/* ATSC-MH */ +/* ATSC-MH specific parameters */ +/** + * enum atscmh_sccc_block_mode - Type of Series Concatenated Convolutional + * Code Block Mode. + * + * @ATSCMH_SCCC_BLK_SEP: + * Separate SCCC: the SCCC outer code mode shall be set independently + * for each Group Region (A, B, C, D) + * @ATSCMH_SCCC_BLK_COMB: + * Combined SCCC: all four Regions shall have the same SCCC outer + * code mode. + * @ATSCMH_SCCC_BLK_RES: + * Reserved. Shouldn't be used. + */ enum atscmh_sccc_block_mode { ATSCMH_SCCC_BLK_SEP = 0, ATSCMH_SCCC_BLK_COMB = 1, ATSCMH_SCCC_BLK_RES = 2, }; +/** + * enum atscmh_sccc_code_mode - Type of Series Concatenated Convolutional + * Code Rate. + * + * @ATSCMH_SCCC_CODE_HLF: + * The outer code rate of a SCCC Block is 1/2 rate. + * @ATSCMH_SCCC_CODE_QTR: + * The outer code rate of a SCCC Block is 1/4 rate. + * @ATSCMH_SCCC_CODE_RES: + * Reserved. Should not be used. + */ enum atscmh_sccc_code_mode { ATSCMH_SCCC_CODE_HLF = 0, ATSCMH_SCCC_CODE_QTR = 1, ATSCMH_SCCC_CODE_RES = 2, }; +/** + * enum atscmh_rs_frame_ensemble - Reed Solomon(RS) frame ensemble. + * + * @ATSCMH_RSFRAME_ENS_PRI: Primary Ensemble. + * @ATSCMH_RSFRAME_ENS_SEC: Secondary Ensemble. + */ enum atscmh_rs_frame_ensemble { ATSCMH_RSFRAME_ENS_PRI = 0, ATSCMH_RSFRAME_ENS_SEC = 1, }; +/** + * enum atscmh_rs_frame_mode - Reed Solomon (RS) frame mode. + * + * @ATSCMH_RSFRAME_PRI_ONLY: + * Single Frame: There is only a primary RS Frame for all Group + * Regions. + * @ATSCMH_RSFRAME_PRI_SEC: + * Dual Frame: There are two separate RS Frames: Primary RS Frame for + * Group Region A and B and Secondary RS Frame for Group Region C and + * D. + * @ATSCMH_RSFRAME_RES: + * Reserved. Shouldn't be used. + */ enum atscmh_rs_frame_mode { ATSCMH_RSFRAME_PRI_ONLY = 0, ATSCMH_RSFRAME_PRI_SEC = 1, ATSCMH_RSFRAME_RES = 2, }; +/** + * enum atscmh_rs_code_mode + * @ATSCMH_RSCODE_211_187: Reed Solomon code (211,187). + * @ATSCMH_RSCODE_223_187: Reed Solomon code (223,187). + * @ATSCMH_RSCODE_235_187: Reed Solomon code (235,187). + * @ATSCMH_RSCODE_RES: Reserved. Shouldn't be used. + */ enum atscmh_rs_code_mode { ATSCMH_RSCODE_211_187 = 0, ATSCMH_RSCODE_223_187 = 1, @@ -385,16 +733,17 @@ enum atscmh_rs_code_mode { #define LNA_AUTO (~0U) /** - * Scale types for the quality parameters. + * enum fecap_scale_params - scale types for the quality parameters. + * * @FE_SCALE_NOT_AVAILABLE: That QoS measure is not available. That * could indicate a temporary or a permanent * condition. * @FE_SCALE_DECIBEL: The scale is measured in 0.001 dB steps, typically - * used on signal measures. + * used on signal measures. * @FE_SCALE_RELATIVE: The scale is a relative percentual measure, - * ranging from 0 (0%) to 0xffff (100%). + * ranging from 0 (0%) to 0xffff (100%). * @FE_SCALE_COUNTER: The scale counts the occurrence of an event, like - * bit error, block error, lapsed time. + * bit error, block error, lapsed time. */ enum fecap_scale_params { FE_SCALE_NOT_AVAILABLE = 0, @@ -406,24 +755,38 @@ enum fecap_scale_params { /** * struct dtv_stats - Used for reading a DTV status property * - * @value: value of the measure. Should range from 0 to 0xffff; * @scale: Filled with enum fecap_scale_params - the scale * in usage for that parameter * + * The ``{unnamed_union}`` may have either one of the values below: + * + * %svalue + * integer value of the measure, for %FE_SCALE_DECIBEL, + * used for dB measures. The unit is 0.001 dB. + * + * %uvalue + * unsigned integer value of the measure, used when @scale is + * either %FE_SCALE_RELATIVE or %FE_SCALE_COUNTER. + * * For most delivery systems, this will return a single value for each * parameter. + * * It should be noticed, however, that new OFDM delivery systems like * ISDB can use different modulation types for each group of carriers. * On such standards, up to 8 groups of statistics can be provided, one * for each carrier group (called "layer" on ISDB). + * * In order to be consistent with other delivery systems, the first * value refers to the entire set of carriers ("global"). - * dtv_status:scale should use the value FE_SCALE_NOT_AVAILABLE when + * + * @scale should use the value %FE_SCALE_NOT_AVAILABLE when * the value for the entire group of carriers or from one specific layer * is not provided by the hardware. - * st.len should be filled with the latest filled status + 1. * - * In other words, for ISDB, those values should be filled like: + * @len should be filled with the latest filled status + 1. + * + * In other words, for ISDB, those values should be filled like:: + * * u.st.stat.svalue[0] = global statistics; * u.st.stat.scale[0] = FE_SCALE_DECIBEL; * u.st.stat.value[1] = layer A statistics; @@ -445,11 +808,39 @@ struct dtv_stats { #define MAX_DTV_STATS 4 +/** + * struct dtv_fe_stats - store Digital TV frontend statistics + * + * @len: length of the statistics - if zero, stats is disabled. + * @stat: array with digital TV statistics. + * + * On most standards, @len can either be 0 or 1. However, for ISDB, each + * layer is modulated in separate. So, each layer may have its own set + * of statistics. If so, stat[0] carries on a global value for the property. + * Indexes 1 to 3 means layer A to B. + */ struct dtv_fe_stats { __u8 len; struct dtv_stats stat[MAX_DTV_STATS]; } __attribute__ ((packed)); +/** + * struct dtv_property - store one of frontend command and its value + * + * @cmd: Digital TV command. + * @reserved: Not used. + * @u: Union with the values for the command. + * @result: Result of the command set (currently unused). + * + * The @u union may have either one of the values below: + * + * %data + * an unsigned 32-bits number. + * %st + * a &struct dtv_fe_stats array of statistics. + * %buffer + * a buffer of up to 32 characters (currently unused). + */ struct dtv_property { __u32 cmd; __u32 reserved[3]; @@ -469,17 +860,70 @@ struct dtv_property { /* num of properties cannot exceed DTV_IOCTL_MAX_MSGS per ioctl */ #define DTV_IOCTL_MAX_MSGS 64 +/** + * struct dtv_properties - a set of command/value pairs. + * + * @num: amount of commands stored at the struct. + * @props: a pointer to &struct dtv_property. + */ struct dtv_properties { __u32 num; struct dtv_property *props; }; +/* + * When set, this flag will disable any zigzagging or other "normal" tuning + * behavior. Additionally, there will be no automatic monitoring of the lock + * status, and hence no frontend events will be generated. If a frontend device + * is closed, this flag will be automatically turned off when the device is + * reopened read-write. + */ +#define FE_TUNE_MODE_ONESHOT 0x01 + +/* Digital TV Frontend API calls */ + +#define FE_GET_INFO _IOR('o', 61, struct dvb_frontend_info) + +#define FE_DISEQC_RESET_OVERLOAD _IO('o', 62) +#define FE_DISEQC_SEND_MASTER_CMD _IOW('o', 63, struct dvb_diseqc_master_cmd) +#define FE_DISEQC_RECV_SLAVE_REPLY _IOR('o', 64, struct dvb_diseqc_slave_reply) +#define FE_DISEQC_SEND_BURST _IO('o', 65) /* fe_sec_mini_cmd_t */ + +#define FE_SET_TONE _IO('o', 66) /* fe_sec_tone_mode_t */ +#define FE_SET_VOLTAGE _IO('o', 67) /* fe_sec_voltage_t */ +#define FE_ENABLE_HIGH_LNB_VOLTAGE _IO('o', 68) /* int */ + +#define FE_READ_STATUS _IOR('o', 69, fe_status_t) +#define FE_READ_BER _IOR('o', 70, __u32) +#define FE_READ_SIGNAL_STRENGTH _IOR('o', 71, __u16) +#define FE_READ_SNR _IOR('o', 72, __u16) +#define FE_READ_UNCORRECTED_BLOCKS _IOR('o', 73, __u32) + +#define FE_SET_FRONTEND_TUNE_MODE _IO('o', 81) /* unsigned int */ +#define FE_GET_EVENT _IOR('o', 78, struct dvb_frontend_event) + +#define FE_DISHNETWORK_SEND_LEGACY_CMD _IO('o', 80) /* unsigned int */ + +#define FE_SET_PROPERTY _IOW('o', 82, struct dtv_properties) +#define FE_GET_PROPERTY _IOR('o', 83, struct dtv_properties) + #if defined(__DVB_CORE__) || !defined (__KERNEL__) /* - * DEPRECATED: The DVBv3 ioctls, structs and enums should not be used on - * newer programs, as it doesn't support the second generation of digital - * TV standards, nor supports newer delivery systems. + * DEPRECATED: Everything below is deprecated in favor of DVBv5 API + * + * The DVBv3 only ioctls, structs and enums should not be used on + * newer programs, as it doesn't support the second generation of + * digital TV standards, nor supports newer delivery systems. + * They also don't support modern frontends with usually support multiple + * delivery systems. + * + * Drivers shouldn't use them. + * + * New applications should use DVBv5 delivery system instead + */ + +/* */ enum fe_bandwidth { @@ -492,7 +936,7 @@ enum fe_bandwidth { BANDWIDTH_1_712_MHZ, }; -/* This is needed for legacy userspace support */ +/* This is kept for legacy userspace support */ typedef enum fe_sec_voltage fe_sec_voltage_t; typedef enum fe_caps fe_caps_t; typedef enum fe_type fe_type_t; @@ -510,6 +954,8 @@ typedef enum fe_pilot fe_pilot_t; typedef enum fe_rolloff fe_rolloff_t; typedef enum fe_delivery_system fe_delivery_system_t; +/* DVBv3 structs */ + struct dvb_qpsk_parameters { __u32 symbol_rate; /* symbol rate in Symbols per second */ fe_code_rate_t fec_inner; /* forward error correction (see above) */ @@ -551,42 +997,12 @@ struct dvb_frontend_event { fe_status_t status; struct dvb_frontend_parameters parameters; }; -#endif - -#define FE_SET_PROPERTY _IOW('o', 82, struct dtv_properties) -#define FE_GET_PROPERTY _IOR('o', 83, struct dtv_properties) - -/** - * When set, this flag will disable any zigzagging or other "normal" tuning - * behaviour. Additionally, there will be no automatic monitoring of the lock - * status, and hence no frontend events will be generated. If a frontend device - * is closed, this flag will be automatically turned off when the device is - * reopened read-write. - */ -#define FE_TUNE_MODE_ONESHOT 0x01 -#define FE_GET_INFO _IOR('o', 61, struct dvb_frontend_info) - -#define FE_DISEQC_RESET_OVERLOAD _IO('o', 62) -#define FE_DISEQC_SEND_MASTER_CMD _IOW('o', 63, struct dvb_diseqc_master_cmd) -#define FE_DISEQC_RECV_SLAVE_REPLY _IOR('o', 64, struct dvb_diseqc_slave_reply) -#define FE_DISEQC_SEND_BURST _IO('o', 65) /* fe_sec_mini_cmd_t */ - -#define FE_SET_TONE _IO('o', 66) /* fe_sec_tone_mode_t */ -#define FE_SET_VOLTAGE _IO('o', 67) /* fe_sec_voltage_t */ -#define FE_ENABLE_HIGH_LNB_VOLTAGE _IO('o', 68) /* int */ - -#define FE_READ_STATUS _IOR('o', 69, fe_status_t) -#define FE_READ_BER _IOR('o', 70, __u32) -#define FE_READ_SIGNAL_STRENGTH _IOR('o', 71, __u16) -#define FE_READ_SNR _IOR('o', 72, __u16) -#define FE_READ_UNCORRECTED_BLOCKS _IOR('o', 73, __u32) +/* DVBv3 API calls */ #define FE_SET_FRONTEND _IOW('o', 76, struct dvb_frontend_parameters) #define FE_GET_FRONTEND _IOR('o', 77, struct dvb_frontend_parameters) -#define FE_SET_FRONTEND_TUNE_MODE _IO('o', 81) /* unsigned int */ -#define FE_GET_EVENT _IOR('o', 78, struct dvb_frontend_event) -#define FE_DISHNETWORK_SEND_LEGACY_CMD _IO('o', 80) /* unsigned int */ +#endif #endif /*_DVBFRONTEND_H_*/ From patchwork Fri Jun 5 16:25:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 11590043 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1C20F618 for ; Fri, 5 Jun 2020 16:29:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 017D3207D8 for ; Fri, 5 Jun 2020 16:29:23 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="uo6n7Hqf" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727015AbgFEQ0J (ORCPT ); Fri, 5 Jun 2020 12:26:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40742 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726987AbgFEQ0I (ORCPT ); Fri, 5 Jun 2020 12:26:08 -0400 Received: from mail-pg1-x542.google.com (mail-pg1-x542.google.com [IPv6:2607:f8b0:4864:20::542]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 086A0C08C5C2; Fri, 5 Jun 2020 09:26:08 -0700 (PDT) Received: by mail-pg1-x542.google.com with SMTP id m1so5392230pgk.1; Fri, 05 Jun 2020 09:26:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=fWpx6f+4wgL8xMRTLX05j8UVK4Mv/r1SKdVKvG+UIsw=; b=uo6n7HqfcM6VUZR43CM1H8xUQpdJkgfQfPZVGILieyWTkZLA+DJmBnr6xQOqpAgi4P MHtEBdaDPjd5LKi32C/K2zWm96qiLzPd8wnoJ8isRVBib/tC3ueP3UtX5ZjOy9nH8s6L H8vD61zb6C+AxPk0ENjz1cNNgrvhCYxkKfcqu/sa/ai7zNouyIVFCVfhE8ZTxXz8kaQ6 Gq1OlQ5u4C42v0czLu5+56VgfOsgRUfZg0VcgOmuT4oWk9HImP+yKzExQnV9p2m1fiFp qZ6V4PVzpHPYMGGIYvRZusComaG1IUenQDO1kHLAd/x83Fy+OvkuNc4sGPKV1rJKpOG7 72uw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=fWpx6f+4wgL8xMRTLX05j8UVK4Mv/r1SKdVKvG+UIsw=; b=UOesNUHdvRdylRN0M/H4GGDmnLehLxQSl23ELpJXGduPPc3EPKIC9NniU+JcxehIYZ mvkPPS/iKe6ZdJhH0ZCpa1JthWWslFr0Vw88nNDJd0Qz2r7iXQ+unXAjQWA4cukS3i2a K4+uNe1LXr/tllIGUYYDuk3pb3JQsofVZ57v2VuVm4969hS3YgxxauWUxPzwYWs95mp+ xvj5yjThQR0jWelZLqQjOjK9T8mmQMylI428j5O5DKmngdkg0ZpOO+dOVDyZYujd1P/X mHdCIeUXUOtWvBwFYDHiGIkUWYIpIL7NtPyFm0oBLe3bnYhyiC+M59mcKKArd3ZsGAo3 ua+g== X-Gm-Message-State: AOAM531+jjI07cmsSZgtBeS8hARXjXnEIMIAJ0zpdG+izwKGtvT8aR+n TVLmB+vhHcQ8kKXS9WxmCQSTRAWB X-Google-Smtp-Source: ABdhPJzzHgGmsx0Aif2ScHBiwMep4HjZ3Ui2LhF+D+YePIxEYb/HPAN8UGfB02GPqOhvQkQksQH6bQ== X-Received: by 2002:a62:6846:: with SMTP id d67mr10705706pfc.167.1591374367137; Fri, 05 Jun 2020 09:26:07 -0700 (PDT) Received: from localhost.localdomain ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id b29sm86205pff.176.2020.06.05.09.26.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Jun 2020 09:26:06 -0700 (PDT) From: Florian Fainelli X-Google-Original-From: Florian Fainelli To: linux-kernel@vger.kernel.org Cc: stable@vger.kernel.org, Mauro Carvalho Chehab , Florian Fainelli , Mauro Carvalho Chehab , Michael Krufky , Alexander Viro , Shuah Khan , Jaedon Shin , Colin Ian King , Katsuhiro Suzuki , Satendra Singh Thakur , linux-media@vger.kernel.org (open list:MEDIA INPUT INFRASTRUCTURE (V4L/DVB)), linux-fsdevel@vger.kernel.org (open list:FILESYSTEMS (VFS and infrastructure)) Subject: [PATCH stable 4.9 05/21] media: dvb_frontend: get rid of get_property() callback Date: Fri, 5 Jun 2020 09:25:02 -0700 Message-Id: <20200605162518.28099-6-florian.fainelli@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200605162518.28099-1-florian.fainelli@broadcom.com> References: <20200605162518.28099-1-florian.fainelli@broadcom.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org From: Mauro Carvalho Chehab commit 8f8a19fcc1a89b83d0ab6d7cf2bcdd272dbd4334 upstream Only lg2160 implement gets_property, but there's no need for that, as no other driver calls this callback, as get_frontend() does the same, and set_frontend() also calls lg2160 get_frontend(). So, get rid of it. Signed-off-by: Mauro Carvalho Chehab Reviewed-by: Michael Ira Krufky Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Florian Fainelli --- drivers/media/dvb-core/dvb_frontend.c | 9 +-------- drivers/media/dvb-core/dvb_frontend.h | 3 --- drivers/media/dvb-frontends/lg2160.c | 14 -------------- 3 files changed, 1 insertion(+), 25 deletions(-) diff --git a/drivers/media/dvb-core/dvb_frontend.c b/drivers/media/dvb-core/dvb_frontend.c index 7eeb5d302c9c..97c825f97b15 100644 --- a/drivers/media/dvb-core/dvb_frontend.c +++ b/drivers/media/dvb-core/dvb_frontend.c @@ -1306,7 +1306,7 @@ static int dtv_property_process_get(struct dvb_frontend *fe, struct dtv_property *tvp, struct file *file) { - int r, ncaps; + int ncaps; switch(tvp->cmd) { case DTV_ENUM_DELSYS: @@ -1517,13 +1517,6 @@ static int dtv_property_process_get(struct dvb_frontend *fe, return -EINVAL; } - /* Allow the frontend to override outgoing properties */ - if (fe->ops.get_property) { - r = fe->ops.get_property(fe, tvp); - if (r < 0) - return r; - } - dtv_property_dump(fe, false, tvp); return 0; diff --git a/drivers/media/dvb-core/dvb_frontend.h b/drivers/media/dvb-core/dvb_frontend.h index fb6e84811504..57cedbe5c2c7 100644 --- a/drivers/media/dvb-core/dvb_frontend.h +++ b/drivers/media/dvb-core/dvb_frontend.h @@ -399,8 +399,6 @@ struct dtv_frontend_properties; * @analog_ops: pointer to struct analog_demod_ops * @set_property: callback function to allow the frontend to validade * incoming properties. Should not be used on new drivers. - * @get_property: callback function to allow the frontend to override - * outcoming properties. Should not be used on new drivers. */ struct dvb_frontend_ops { @@ -463,7 +461,6 @@ struct dvb_frontend_ops { struct analog_demod_ops analog_ops; int (*set_property)(struct dvb_frontend* fe, struct dtv_property* tvp); - int (*get_property)(struct dvb_frontend* fe, struct dtv_property* tvp); }; #ifdef __DVB_CORE__ diff --git a/drivers/media/dvb-frontends/lg2160.c b/drivers/media/dvb-frontends/lg2160.c index f51a3a0b3949..1b640651531d 100644 --- a/drivers/media/dvb-frontends/lg2160.c +++ b/drivers/media/dvb-frontends/lg2160.c @@ -1052,16 +1052,6 @@ static int lg216x_get_frontend(struct dvb_frontend *fe, return ret; } -static int lg216x_get_property(struct dvb_frontend *fe, - struct dtv_property *tvp) -{ - struct dtv_frontend_properties *c = &fe->dtv_property_cache; - - return (DTV_ATSCMH_FIC_VER == tvp->cmd) ? - lg216x_get_frontend(fe, c) : 0; -} - - static int lg2160_set_frontend(struct dvb_frontend *fe) { struct lg216x_state *state = fe->demodulator_priv; @@ -1372,8 +1362,6 @@ static struct dvb_frontend_ops lg2160_ops = { .init = lg216x_init, .sleep = lg216x_sleep, #endif - .get_property = lg216x_get_property, - .set_frontend = lg2160_set_frontend, .get_frontend = lg216x_get_frontend, .get_tune_settings = lg216x_get_tune_settings, @@ -1400,8 +1388,6 @@ static struct dvb_frontend_ops lg2161_ops = { .init = lg216x_init, .sleep = lg216x_sleep, #endif - .get_property = lg216x_get_property, - .set_frontend = lg2160_set_frontend, .get_frontend = lg216x_get_frontend, .get_tune_settings = lg216x_get_tune_settings, From patchwork Fri Jun 5 16:25:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 11590037 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B12231391 for ; Fri, 5 Jun 2020 16:29:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 93F09207D8 for ; Fri, 5 Jun 2020 16:29:03 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ZKppMvOf" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727930AbgFEQ3B (ORCPT ); Fri, 5 Jun 2020 12:29:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40752 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727024AbgFEQ0K (ORCPT ); Fri, 5 Jun 2020 12:26:10 -0400 Received: from mail-pg1-x543.google.com (mail-pg1-x543.google.com [IPv6:2607:f8b0:4864:20::543]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 275F5C08C5C2; Fri, 5 Jun 2020 09:26:10 -0700 (PDT) Received: by mail-pg1-x543.google.com with SMTP id d10so5363382pgn.4; Fri, 05 Jun 2020 09:26:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=IEApNuKp8gKWvflXdIy4+ZsvdThFgVJg626w5D+H1A0=; b=ZKppMvOf6dQxrlW1P8yxfhr/IhrEHAIY4xLXS6TZ/nZd1CEB9OKfPrCJRYA6XUxTV6 T8V+GemHui3biwV7wMGN1a/TERAtJtiU4KvcHx9+DaCKW4E9g1E2G7baHhOnpHfk0DnY P6gv8ZhAcshCWSJE0GiTdNoF3sts1isfPcy+w0Tpcq0deZPYiYt0jx1AenyaUy3Mszbl LSFJWXvMrzmJM5jhyBtHsHZ1UNj69DaCfzr7DeP+9Qwk6lQbO//BxcOnq8HvNwPx8VtB VI+3Ud7lxRNg5EiBndcWaDBHXEeR6emEA+OGhy7/1USUu3xV5/UzCA6Hawo0tKtLUwr1 MtgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=IEApNuKp8gKWvflXdIy4+ZsvdThFgVJg626w5D+H1A0=; b=kt/urm4lIsPDOATzUVbVNEcgz25A+Y6/eEEV7CEpUiJHkhlc7410wx3s1p7LHHumVC mcW0hJhIUStEQjUNA33uvN5/vmt7DgJVO3RXpAckjMt6+UDRP5vZhhfVc0SnVXW3+FZ+ toIZJOeoB/ITyb0kw5xogcUY1g4yp3fCcRYfXFXIUsudfq4zTJIflmSp5yDdohDkXPdU UAsUXvuqwYDwlyzwsAA/3exoQRI1c+wmtr6ri5B/vEEGpLg869H24OEBL48tZEYvEzG0 mDW+sMO6Nv3yeN6ZVrAPcUXcRApi8QNDLh1EB12u5o8iLAz0N4xx6BW2L1lKXc4XsJSK 7hAA== X-Gm-Message-State: AOAM530mbdj8SoJdGfwVY4IaWvJZPN0f1uFS32WCB8cpgYmPC04cpUF6 agSoFXM0ZsIXt9zivOe43shw8uk3 X-Google-Smtp-Source: ABdhPJxNyiAyQP0+5b2n1II/vh9F5sV6RSsX9MwOgGH3s+ZJ04N+1dI1EJJ6OrPdlE7xeS5jyEFIUA== X-Received: by 2002:aa7:9acc:: with SMTP id x12mr10428830pfp.24.1591374369200; Fri, 05 Jun 2020 09:26:09 -0700 (PDT) Received: from localhost.localdomain ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id b29sm86205pff.176.2020.06.05.09.26.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Jun 2020 09:26:08 -0700 (PDT) From: Florian Fainelli X-Google-Original-From: Florian Fainelli To: linux-kernel@vger.kernel.org Cc: stable@vger.kernel.org, Mauro Carvalho Chehab , Florian Fainelli , Mauro Carvalho Chehab , Michael Krufky , Alexander Viro , Shuah Khan , Jaedon Shin , Colin Ian King , Katsuhiro Suzuki , Satendra Singh Thakur , linux-media@vger.kernel.org (open list:MEDIA INPUT INFRASTRUCTURE (V4L/DVB)), linux-fsdevel@vger.kernel.org (open list:FILESYSTEMS (VFS and infrastructure)) Subject: [PATCH stable 4.9 06/21] media: stv0288: get rid of set_property boilerplate Date: Fri, 5 Jun 2020 09:25:03 -0700 Message-Id: <20200605162518.28099-7-florian.fainelli@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200605162518.28099-1-florian.fainelli@broadcom.com> References: <20200605162518.28099-1-florian.fainelli@broadcom.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org From: Mauro Carvalho Chehab commit 473e4b4c1cf3046fc6b3437be9a9f3c89c2e61ef upstream This driver doesn't implement support for set_property(). Yet, it implements a boilerplate for it. Get rid of it. Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Florian Fainelli --- drivers/media/dvb-frontends/stv0288.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/drivers/media/dvb-frontends/stv0288.c b/drivers/media/dvb-frontends/stv0288.c index c93d9a45f7f7..2b8c75f28d2e 100644 --- a/drivers/media/dvb-frontends/stv0288.c +++ b/drivers/media/dvb-frontends/stv0288.c @@ -447,12 +447,6 @@ static int stv0288_read_ucblocks(struct dvb_frontend *fe, u32 *ucblocks) return 0; } -static int stv0288_set_property(struct dvb_frontend *fe, struct dtv_property *p) -{ - dprintk("%s(..)\n", __func__); - return 0; -} - static int stv0288_set_frontend(struct dvb_frontend *fe) { struct stv0288_state *state = fe->demodulator_priv; @@ -568,7 +562,6 @@ static struct dvb_frontend_ops stv0288_ops = { .set_tone = stv0288_set_tone, .set_voltage = stv0288_set_voltage, - .set_property = stv0288_set_property, .set_frontend = stv0288_set_frontend, }; From patchwork Fri Jun 5 16:25:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 11590039 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B211C618 for ; Fri, 5 Jun 2020 16:29:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9342B20823 for ; Fri, 5 Jun 2020 16:29:17 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="lRsBh9rY" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728311AbgFEQ3A (ORCPT ); Fri, 5 Jun 2020 12:29:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40756 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727037AbgFEQ0M (ORCPT ); Fri, 5 Jun 2020 12:26:12 -0400 Received: from mail-pf1-x441.google.com (mail-pf1-x441.google.com [IPv6:2607:f8b0:4864:20::441]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2B23EC08C5C3; Fri, 5 Jun 2020 09:26:12 -0700 (PDT) Received: by mail-pf1-x441.google.com with SMTP id 64so5120575pfg.8; Fri, 05 Jun 2020 09:26:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=dASDXMiZEph5YCTisMlHTdhBBOP44OwUKjYtbrazK0w=; b=lRsBh9rYlD3/klFZqakJ0sVqCrjSPf2sDijjIOPnDVwZ7apuHjMIwwQDkp0+o754gF 4/xGNuMr+V1FHGugjT8Ie3mOvRMgbkxkDzn1B1wmUksTu/6TkerWdC4b5JgLu6MmHpVq qGU0/l0rodSFQVrMSXc6gP4B7Pqb9bcYNABfaqO0EyBbBVsnEskMDEt8tJxFCGtU/EQe i36ujV6luk8DndCyrMCvPNxMMfB34OiDPeljv9TEbLLh1INxeEBEOOVMaFI1bmu1XC+J oOshsyJtmIG+waJl7NW2fTf6KGn3GipfU5B45FbpYN7hvkgZ8TLEm6+UYw1cS+qD75L8 9+iQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=dASDXMiZEph5YCTisMlHTdhBBOP44OwUKjYtbrazK0w=; b=jYpXyNsYad1wDZFYYagu/wWmccRmASORfeJwti5T59pcWhouLMfzbubtL+DcU0ssxn QQK2lQv9Xi02wRLGPAA8yB9IJ3mL4gMvO/X66MvM8A1G2WWsjq7320WeeVkrfA6nHDOG jfnog2fb+dtSP4I+kN/HUy+Xte5+ZHlu/hKZnQOvX0c4YYO57H+HE9wLkD02MILcDtRh rfXXHTFAIXH2RPr5G9Dh5Zs6RnWfuhfCtIseJO13v65ZqYAEVA5/imdlRqrP9kFK7naa y1MLPxZQTPYpjyUx/ZUeOPCRc/JvzTTITTjcQo8QPHEvzbX4V7eb33/szFJBXfpTGpme L8qQ== X-Gm-Message-State: AOAM531AuyWN6mhHlqDRaVgXuzWen0wNtzDbgQEeAb/ioi0o5QQ5tJWV /nlxBOSvnKhkQILSWsWSu3EmWjga X-Google-Smtp-Source: ABdhPJwXx/cGe9xW2SYlzP6+8kzFsQ21N0G0adYtcyJqEYt6Q8PYpLKRa6OKd3iLBwEm+8laxXxzXg== X-Received: by 2002:a63:7519:: with SMTP id q25mr9985787pgc.224.1591374371249; Fri, 05 Jun 2020 09:26:11 -0700 (PDT) Received: from localhost.localdomain ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id b29sm86205pff.176.2020.06.05.09.26.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Jun 2020 09:26:10 -0700 (PDT) From: Florian Fainelli X-Google-Original-From: Florian Fainelli To: linux-kernel@vger.kernel.org Cc: stable@vger.kernel.org, Mauro Carvalho Chehab , Florian Fainelli , Mauro Carvalho Chehab , Michael Krufky , Alexander Viro , Shuah Khan , Jaedon Shin , Colin Ian King , Katsuhiro Suzuki , Satendra Singh Thakur , linux-media@vger.kernel.org (open list:MEDIA INPUT INFRASTRUCTURE (V4L/DVB)), linux-fsdevel@vger.kernel.org (open list:FILESYSTEMS (VFS and infrastructure)) Subject: [PATCH stable 4.9 07/21] media: stv6110: get rid of a srate dead code Date: Fri, 5 Jun 2020 09:25:04 -0700 Message-Id: <20200605162518.28099-8-florian.fainelli@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200605162518.28099-1-florian.fainelli@broadcom.com> References: <20200605162518.28099-1-florian.fainelli@broadcom.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org From: Mauro Carvalho Chehab commit 282996925b4d78f9795d176f7fb409281c98d56d upstream The stv6110 has a weird code that checks if get_property and set_property ioctls are defined. If they're, it initializes a "srate" var from properties cache. Otherwise, it sets to 15MBaud, with won't make any sense. Thankfully, it seems that someone else discovered the issue in the past, as "srate" is currently not used anywhere! So, get rid of that really weird dead code logic. Reported-by: Honza Petrous Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Florian Fainelli --- drivers/media/dvb-frontends/stv6110.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/drivers/media/dvb-frontends/stv6110.c b/drivers/media/dvb-frontends/stv6110.c index 66a5a7f2295c..93262b13c644 100644 --- a/drivers/media/dvb-frontends/stv6110.c +++ b/drivers/media/dvb-frontends/stv6110.c @@ -263,11 +263,9 @@ static int stv6110_get_frequency(struct dvb_frontend *fe, u32 *frequency) static int stv6110_set_frequency(struct dvb_frontend *fe, u32 frequency) { struct stv6110_priv *priv = fe->tuner_priv; - struct dtv_frontend_properties *c = &fe->dtv_property_cache; u8 ret = 0x04; u32 divider, ref, p, presc, i, result_freq, vco_freq; s32 p_calc, p_calc_opt = 1000, r_div, r_div_opt = 0, p_val; - s32 srate; dprintk("%s, freq=%d kHz, mclk=%d Hz\n", __func__, frequency, priv->mclk); @@ -278,13 +276,6 @@ static int stv6110_set_frequency(struct dvb_frontend *fe, u32 frequency) ((((priv->mclk / 1000000) - 16) & 0x1f) << 3); /* BB_GAIN = db/2 */ - if (fe->ops.set_property && fe->ops.get_property) { - srate = c->symbol_rate; - dprintk("%s: Get Frontend parameters: srate=%d\n", - __func__, srate); - } else - srate = 15000000; - priv->regs[RSTV6110_CTRL2] &= ~0x0f; priv->regs[RSTV6110_CTRL2] |= (priv->gain & 0x0f); From patchwork Fri Jun 5 16:25:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 11590021 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3EA70618 for ; Fri, 5 Jun 2020 16:28:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 21DBB2074B for ; Fri, 5 Jun 2020 16:28:50 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="OILMBMu3" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727786AbgFEQ0V (ORCPT ); Fri, 5 Jun 2020 12:26:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40766 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727061AbgFEQ0P (ORCPT ); Fri, 5 Jun 2020 12:26:15 -0400 Received: from mail-pj1-x1041.google.com (mail-pj1-x1041.google.com [IPv6:2607:f8b0:4864:20::1041]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7EC13C08C5C4; Fri, 5 Jun 2020 09:26:14 -0700 (PDT) Received: by mail-pj1-x1041.google.com with SMTP id ne5so322202pjb.5; Fri, 05 Jun 2020 09:26:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=yl2c3lr1cROZ0PCJowYf2rTBlLEbdPel5A+cfI8kcRw=; b=OILMBMu3f4uUqmw7nraOQ+HIRXbapVevszh8tlqmfiI+uK/PqtzYe9i85L+n4VuTyY i8cNjmnoatRFwHVAH/OK++jMmG+J4CTJlk6fpW+PMwRz1if1C9OjWBh8G/H0Mps33wIM 8VMsbNb4SvAUNrQ8hwh8eiea3Wi3Vfz0j/rzI5Okgu3g8JmmP+SumcV67tMecck8YUV4 mHKkAsime/KB2o+3xxr7goDFmp+qUl0NLIMgfMRdBhvE6PZmCQridRRK5Rfe6ZAb/uEQ ZixzouBisij0CqukR4JA5cMW1J3qkiQtSx7HTlDHSUl3AF10Bcok8BuHR0XnKyoAE2/u g1xw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=yl2c3lr1cROZ0PCJowYf2rTBlLEbdPel5A+cfI8kcRw=; b=NtYivj93/JAxIRAVmXxa7HbqQoyvr2cd9J3qQGNPHJFXo165A89m8vtP15VsjTyM+G w+ijlFJP4X/ZxvdOQa6+01pN75weFd2vCDPxIahbADmj0UIxtNVv82khz9Hssbk3zUHl xUVP8iuFtshj1Geiufo6Wfn6BB/kQ7vqSgAxqgrFE6SOQFmB63PEbW4R5Q9bv+mzJI/W Y/n67jmv0ubTeLwtHvASkcJGjYXQkGfSmn/Zq51tvfkBXvHjRf9dkaYwLIbhKAxT3EJZ CVzoMpmQ7eKHDtLpFuQ8l5OTq6yLQ/hSJZNoqV+ORLeSEPcCbiLgIt9YnlSvvADYejCU DLZQ== X-Gm-Message-State: AOAM532AtDgar4H5GskV+fIye0wu9MO6A9bY1ODUncqjvJe5nuus4tnY fslQtj2orVrSUSvZyX0s1mqaoNf6 X-Google-Smtp-Source: ABdhPJzjGSSaf8Gl1ZdNII6917kbMvgnzC/3jYmA+FNfnh4K1xXdh6ldPtySdckZrVMw2T//+N5EwQ== X-Received: by 2002:a17:90a:17ed:: with SMTP id q100mr3638937pja.80.1591374373641; Fri, 05 Jun 2020 09:26:13 -0700 (PDT) Received: from localhost.localdomain ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id b29sm86205pff.176.2020.06.05.09.26.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Jun 2020 09:26:12 -0700 (PDT) From: Florian Fainelli X-Google-Original-From: Florian Fainelli To: linux-kernel@vger.kernel.org Cc: stable@vger.kernel.org, Mauro Carvalho Chehab , Florian Fainelli , Mauro Carvalho Chehab , Michael Krufky , Alexander Viro , Shuah Khan , Jaedon Shin , Colin Ian King , Katsuhiro Suzuki , Satendra Singh Thakur , linux-media@vger.kernel.org (open list:MEDIA INPUT INFRASTRUCTURE (V4L/DVB)), linux-fsdevel@vger.kernel.org (open list:FILESYSTEMS (VFS and infrastructure)) Subject: [PATCH stable 4.9 08/21] media: friio-fe: get rid of set_property() Date: Fri, 5 Jun 2020 09:25:05 -0700 Message-Id: <20200605162518.28099-9-florian.fainelli@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200605162518.28099-1-florian.fainelli@broadcom.com> References: <20200605162518.28099-1-florian.fainelli@broadcom.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org From: Mauro Carvalho Chehab commit b2c41ca9632e686e79f6c9db9c5f75666d37926e upstream This callback is not actually doing anything but making it to return an error depending on the DTV frontend command. Well, that could break userspace for no good reason, and, if needed, should be implemented, instead, at set_frontend() callback. So, get rid of it. Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Florian Fainelli --- drivers/media/usb/dvb-usb/friio-fe.c | 24 ------------------------ 1 file changed, 24 deletions(-) diff --git a/drivers/media/usb/dvb-usb/friio-fe.c b/drivers/media/usb/dvb-usb/friio-fe.c index 979f05b4b87c..237f12f9a7f2 100644 --- a/drivers/media/usb/dvb-usb/friio-fe.c +++ b/drivers/media/usb/dvb-usb/friio-fe.c @@ -261,28 +261,6 @@ static int jdvbt90502_read_signal_strength(struct dvb_frontend *fe, return 0; } - -/* filter out un-supported properties to notify users */ -static int jdvbt90502_set_property(struct dvb_frontend *fe, - struct dtv_property *tvp) -{ - int r = 0; - - switch (tvp->cmd) { - case DTV_DELIVERY_SYSTEM: - if (tvp->u.data != SYS_ISDBT) - r = -EINVAL; - break; - case DTV_CLEAR: - case DTV_TUNE: - case DTV_FREQUENCY: - break; - default: - r = -EINVAL; - } - return r; -} - static int jdvbt90502_set_frontend(struct dvb_frontend *fe) { struct dtv_frontend_properties *p = &fe->dtv_property_cache; @@ -457,8 +435,6 @@ static struct dvb_frontend_ops jdvbt90502_ops = { .init = jdvbt90502_init, .write = _jdvbt90502_write, - .set_property = jdvbt90502_set_property, - .set_frontend = jdvbt90502_set_frontend, .read_status = jdvbt90502_read_status, From patchwork Fri Jun 5 16:25:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 11589979 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 14324618 for ; Fri, 5 Jun 2020 16:26:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EFD2E2074B for ; Fri, 5 Jun 2020 16:26:21 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Hg2u48S6" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727115AbgFEQ0U (ORCPT ); Fri, 5 Jun 2020 12:26:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40774 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727083AbgFEQ0Q (ORCPT ); Fri, 5 Jun 2020 12:26:16 -0400 Received: from mail-pj1-x1044.google.com (mail-pj1-x1044.google.com [IPv6:2607:f8b0:4864:20::1044]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EBFA6C08C5C2; Fri, 5 Jun 2020 09:26:16 -0700 (PDT) Received: by mail-pj1-x1044.google.com with SMTP id jz3so2793353pjb.0; Fri, 05 Jun 2020 09:26:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=4mgoDUsj8qd3U36+CA2uGlc/0AibJkfSi1z/E24vv4c=; b=Hg2u48S6166BZZDCriE16P7Z9nJJbj1RrQk8zDGkmVWGFXMY2v/NVjXhj3yjLkP1jN 9wlcXFoGZdbvr0JJ95Ycn0nnWNFm6I34/nr+lmKWkfR9ICWz18Gah3O+IMab7sFkK06u yT/Clx4EOetR96GOvoSx85SXbV8xgPbV0JMVP3yq/+RGm4Lw5Kz3OI5T7uAFMU2twl+R D7nWzh89qXW6m1ExsXlzlHC4f1oDYEU/OFJ24cY49ddvqfjr5crSX4a1qR9OTlXJzbSv dwKLBtzcq/J9hMiN6t3moE9CAr1aLI6jxfdOIU4s9uqXFCKWLlyDP1PwQVGCirzQeTTi DdoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=4mgoDUsj8qd3U36+CA2uGlc/0AibJkfSi1z/E24vv4c=; b=rwVztJ4gRRGxoZjI0GLZI4oSMQpAFs/DRgw8BYtZt4ibADLCrb0YHI49ddTuZiPvPA HJkyWXjRsFU0aryDAyh6vcysfnXpRrr5DS7gwhuJH8jOGwHZGNazNQhzC6X2ygSvKMUe VmOcCRQtz9Iu0xvhV1qi35Es3EmFwBAHGkpDek99wiXzKkq8ac35wb07xsA5YyB0JXas U9JwP4klGojkS4G7hFen3eMgpufGlSEirguqKn18W/lJg07FGysorM0gNo3sXo/Jkvsb S5QEycuESZpNBAHsHeXzG9fZT/0XA1zOGpG1m8HYt2MhSRLb7ljofl9tQyLzeAvmCGyP +xKA== X-Gm-Message-State: AOAM532Zddh5NS5n9JbsGXspLK6UelgeD0U4t0U3mWg2LDdyCQuqCSsi 4vFkzqtuPhw9rukCaTHDtLL/csov X-Google-Smtp-Source: ABdhPJz4+nYoo5tYqI4UZ0dOGNJ5ZN+SiXUhFLRItWvmIkIJhs3id6BOoBtto+pgeKLOTpSrf+CiYw== X-Received: by 2002:a17:90a:6344:: with SMTP id v4mr3642685pjs.27.1591374376017; Fri, 05 Jun 2020 09:26:16 -0700 (PDT) Received: from localhost.localdomain ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id b29sm86205pff.176.2020.06.05.09.26.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Jun 2020 09:26:15 -0700 (PDT) From: Florian Fainelli X-Google-Original-From: Florian Fainelli To: linux-kernel@vger.kernel.org Cc: stable@vger.kernel.org, Mauro Carvalho Chehab , Florian Fainelli , Mauro Carvalho Chehab , Michael Krufky , Alexander Viro , Shuah Khan , Jaedon Shin , Colin Ian King , Katsuhiro Suzuki , Satendra Singh Thakur , linux-media@vger.kernel.org (open list:MEDIA INPUT INFRASTRUCTURE (V4L/DVB)), linux-fsdevel@vger.kernel.org (open list:FILESYSTEMS (VFS and infrastructure)) Subject: [PATCH stable 4.9 09/21] media: dvb_frontend: get rid of set_property() callback Date: Fri, 5 Jun 2020 09:25:06 -0700 Message-Id: <20200605162518.28099-10-florian.fainelli@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200605162518.28099-1-florian.fainelli@broadcom.com> References: <20200605162518.28099-1-florian.fainelli@broadcom.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org From: Mauro Carvalho Chehab commit 6680e73b5226114992acfc11f9cf5730f706fb01 upstream Now that all clients of set_property() were removed, get rid of this callback. Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Florian Fainelli --- drivers/media/dvb-core/dvb_frontend.c | 7 ------- drivers/media/dvb-core/dvb_frontend.h | 5 ----- 2 files changed, 12 deletions(-) diff --git a/drivers/media/dvb-core/dvb_frontend.c b/drivers/media/dvb-core/dvb_frontend.c index 97c825f97b15..2bf55a786e29 100644 --- a/drivers/media/dvb-core/dvb_frontend.c +++ b/drivers/media/dvb-core/dvb_frontend.c @@ -1751,13 +1751,6 @@ static int dtv_property_process_set(struct dvb_frontend *fe, int r = 0; struct dtv_frontend_properties *c = &fe->dtv_property_cache; - /* Allow the frontend to validate incoming properties */ - if (fe->ops.set_property) { - r = fe->ops.set_property(fe, tvp); - if (r < 0) - return r; - } - dtv_property_dump(fe, true, tvp); switch(tvp->cmd) { diff --git a/drivers/media/dvb-core/dvb_frontend.h b/drivers/media/dvb-core/dvb_frontend.h index 57cedbe5c2c7..f852f0a49f42 100644 --- a/drivers/media/dvb-core/dvb_frontend.h +++ b/drivers/media/dvb-core/dvb_frontend.h @@ -397,11 +397,8 @@ struct dtv_frontend_properties; * @search: callback function used on some custom algo search algos. * @tuner_ops: pointer to struct dvb_tuner_ops * @analog_ops: pointer to struct analog_demod_ops - * @set_property: callback function to allow the frontend to validade - * incoming properties. Should not be used on new drivers. */ struct dvb_frontend_ops { - struct dvb_frontend_info info; u8 delsys[MAX_DELSYS]; @@ -459,8 +456,6 @@ struct dvb_frontend_ops { struct dvb_tuner_ops tuner_ops; struct analog_demod_ops analog_ops; - - int (*set_property)(struct dvb_frontend* fe, struct dtv_property* tvp); }; #ifdef __DVB_CORE__ From patchwork Fri Jun 5 16:25:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 11590031 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 963BB913 for ; Fri, 5 Jun 2020 16:29:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6D2472077D for ; Fri, 5 Jun 2020 16:29:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="B7CLR+n7" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727779AbgFEQ3A (ORCPT ); Fri, 5 Jun 2020 12:29:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40784 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727094AbgFEQ0T (ORCPT ); Fri, 5 Jun 2020 12:26:19 -0400 Received: from mail-pl1-x643.google.com (mail-pl1-x643.google.com [IPv6:2607:f8b0:4864:20::643]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3FEB8C08C5C4; Fri, 5 Jun 2020 09:26:19 -0700 (PDT) Received: by mail-pl1-x643.google.com with SMTP id g12so3820798pll.10; Fri, 05 Jun 2020 09:26:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=P9QFzVDXmyF/4FAK3YhuPZVq3F8vZzWLPk9FHl2uNlY=; b=B7CLR+n7xCrM/7jGBaWosCExnekVU0GmOisXCHtPqSoYy+yNncf0PeQsqqCsYn7pmy qwelSsGwTrair18RdjQNiKk5vIiWOvq+gGaa+6jROE+qlFyLNlA6KZ84NbWNtxxD9OOK zlXfrtCnl+4/U/sYBRVQ4+kEMFgG9qnuBqy1xHAd7h3UZgXh45fEp246L7ukIDsc+pR4 Hn3zfRXtHXUP9XJ15TXVxaIQWzhe9WAT814y0Cun9vZUVvDNENUjy114GCvatc3NN9bb z4uFq0Nu8fK+1uowop7CvZ66FwpW5Eb+UHzDZkA3xejPn1WZSambm9eXut2rAhlDKu90 yEXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=P9QFzVDXmyF/4FAK3YhuPZVq3F8vZzWLPk9FHl2uNlY=; b=f2eCGtPQrJwAtpG0pG5P/7PMrQxXPCAGQ4Y5IVbRuG01j3hdp7urrLMesPca8r2S+J +I3jqNAmGQwoyiTV2DCxwRqAB+ILk7K27pFWJUS/CG83YhAhdF2OE7041ItNbbBWq1Y0 Og5gOH/ow1hpTiqmQY1dP6FENp/6SCoPdXl29Lkv5qfgWiqhZTsTeoUz1/XHXGWkkEtv 9uF6oxMWy5JXcA1jK8pO0j8awEuJs8rGMg0NPn+5tG4nXP+KZhgkrEL+A4QEiF5GZS1o 7apcnrkDs6qEUxSkninFLLj+CaTYltmtksZVUFuH5YWK6WqSqDxSvqFA3DDGBsJDfob6 uOqA== X-Gm-Message-State: AOAM533ERb4rrANqQ6lkd492CCRKTAtdHZjTZkOPCWTOROAzQr7JvvAw uk4sqUYsvmZmIxnB5+EfPV+zZKwI X-Google-Smtp-Source: ABdhPJzLsTKKOuLCzSt+NPiC0yKqidFmbux2ObQg9JpxfsHKAa649lwl+xLQS+4u1vaRYtZhPh1hUQ== X-Received: by 2002:a17:902:b716:: with SMTP id d22mr9269877pls.33.1591374378165; Fri, 05 Jun 2020 09:26:18 -0700 (PDT) Received: from localhost.localdomain ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id b29sm86205pff.176.2020.06.05.09.26.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Jun 2020 09:26:17 -0700 (PDT) From: Florian Fainelli X-Google-Original-From: Florian Fainelli To: linux-kernel@vger.kernel.org Cc: stable@vger.kernel.org, Mauro Carvalho Chehab , Florian Fainelli , Mauro Carvalho Chehab , Michael Krufky , Alexander Viro , Shuah Khan , Jaedon Shin , Colin Ian King , Katsuhiro Suzuki , Satendra Singh Thakur , linux-media@vger.kernel.org (open list:MEDIA INPUT INFRASTRUCTURE (V4L/DVB)), linux-fsdevel@vger.kernel.org (open list:FILESYSTEMS (VFS and infrastructure)) Subject: [PATCH stable 4.9 10/21] media: dvb_frontend: cleanup dvb_frontend_ioctl_properties() Date: Fri, 5 Jun 2020 09:25:07 -0700 Message-Id: <20200605162518.28099-11-florian.fainelli@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200605162518.28099-1-florian.fainelli@broadcom.com> References: <20200605162518.28099-1-florian.fainelli@broadcom.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org From: Mauro Carvalho Chehab commit 2b5df42b8dec69fb926a242007fd462343db4408 upstream Use a switch() on this function, just like on other ioctl handlers and handle parameters inside each part of the switch. That makes it easier to integrate with the already existing ioctl handler function. Reviewed-by: Shuah Khan Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Florian Fainelli --- drivers/media/dvb-core/dvb_frontend.c | 83 ++++++++++++++++----------- 1 file changed, 51 insertions(+), 32 deletions(-) diff --git a/drivers/media/dvb-core/dvb_frontend.c b/drivers/media/dvb-core/dvb_frontend.c index 2bf55a786e29..c446f51be21a 100644 --- a/drivers/media/dvb-core/dvb_frontend.c +++ b/drivers/media/dvb-core/dvb_frontend.c @@ -1956,21 +1956,25 @@ static int dvb_frontend_ioctl_properties(struct file *file, struct dvb_frontend *fe = dvbdev->priv; struct dvb_frontend_private *fepriv = fe->frontend_priv; struct dtv_frontend_properties *c = &fe->dtv_property_cache; - int err = 0; - - struct dtv_properties *tvps = parg; - struct dtv_property *tvp = NULL; - int i; + int err, i; dev_dbg(fe->dvb->device, "%s:\n", __func__); - if (cmd == FE_SET_PROPERTY) { - dev_dbg(fe->dvb->device, "%s: properties.num = %d\n", __func__, tvps->num); - dev_dbg(fe->dvb->device, "%s: properties.props = %p\n", __func__, tvps->props); + switch(cmd) { + case FE_SET_PROPERTY: { + struct dtv_properties *tvps = parg; + struct dtv_property *tvp = NULL; + + dev_dbg(fe->dvb->device, "%s: properties.num = %d\n", + __func__, tvps->num); + dev_dbg(fe->dvb->device, "%s: properties.props = %p\n", + __func__, tvps->props); - /* Put an arbitrary limit on the number of messages that can - * be sent at once */ - if ((tvps->num == 0) || (tvps->num > DTV_IOCTL_MAX_MSGS)) + /* + * Put an arbitrary limit on the number of messages that can + * be sent at once + */ + if (!tvps->num || (tvps->num > DTV_IOCTL_MAX_MSGS)) return -EINVAL; tvp = memdup_user(tvps->props, tvps->num * sizeof(*tvp)); @@ -1979,23 +1983,34 @@ static int dvb_frontend_ioctl_properties(struct file *file, for (i = 0; i < tvps->num; i++) { err = dtv_property_process_set(fe, tvp + i, file); - if (err < 0) - goto out; + if (err < 0) { + kfree(tvp); + return err; + } (tvp + i)->result = err; } if (c->state == DTV_TUNE) dev_dbg(fe->dvb->device, "%s: Property cache is full, tuning\n", __func__); - } else if (cmd == FE_GET_PROPERTY) { + kfree(tvp); + break; + } + case FE_GET_PROPERTY: { + struct dtv_properties *tvps = parg; + struct dtv_property *tvp = NULL; struct dtv_frontend_properties getp = fe->dtv_property_cache; - dev_dbg(fe->dvb->device, "%s: properties.num = %d\n", __func__, tvps->num); - dev_dbg(fe->dvb->device, "%s: properties.props = %p\n", __func__, tvps->props); + dev_dbg(fe->dvb->device, "%s: properties.num = %d\n", + __func__, tvps->num); + dev_dbg(fe->dvb->device, "%s: properties.props = %p\n", + __func__, tvps->props); - /* Put an arbitrary limit on the number of messages that can - * be sent at once */ - if ((tvps->num == 0) || (tvps->num > DTV_IOCTL_MAX_MSGS)) + /* + * Put an arbitrary limit on the number of messages that can + * be sent at once + */ + if (!tvps->num || (tvps->num > DTV_IOCTL_MAX_MSGS)) return -EINVAL; tvp = memdup_user(tvps->props, tvps->num * sizeof(*tvp)); @@ -2010,28 +2025,32 @@ static int dvb_frontend_ioctl_properties(struct file *file, */ if (fepriv->state != FESTATE_IDLE) { err = dtv_get_frontend(fe, &getp, NULL); - if (err < 0) - goto out; + if (err < 0) { + kfree(tvp); + return err; + } } for (i = 0; i < tvps->num; i++) { err = dtv_property_process_get(fe, &getp, tvp + i, file); - if (err < 0) - goto out; + if (err < 0) { + kfree(tvp); + return err; + } (tvp + i)->result = err; } if (copy_to_user((void __user *)tvps->props, tvp, tvps->num * sizeof(struct dtv_property))) { - err = -EFAULT; - goto out; + kfree(tvp); + return -EFAULT; } - - } else - err = -EOPNOTSUPP; - -out: - kfree(tvp); - return err; + kfree(tvp); + break; + } + default: + return -ENOTSUPP; + } /* switch */ + return 0; } static int dtv_set_frontend(struct dvb_frontend *fe) From patchwork Fri Jun 5 16:25:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 11590025 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6FC3E618 for ; Fri, 5 Jun 2020 16:28:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3D6D72074B for ; Fri, 5 Jun 2020 16:28:51 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="pViyF2rY" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727062AbgFEQ2t (ORCPT ); Fri, 5 Jun 2020 12:28:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40794 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727779AbgFEQ0V (ORCPT ); Fri, 5 Jun 2020 12:26:21 -0400 Received: from mail-pg1-x544.google.com (mail-pg1-x544.google.com [IPv6:2607:f8b0:4864:20::544]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8AA89C08C5C2; Fri, 5 Jun 2020 09:26:21 -0700 (PDT) Received: by mail-pg1-x544.google.com with SMTP id r10so5335423pgv.8; Fri, 05 Jun 2020 09:26:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=h7GMiEUFly34W6euhCTBI4Vi3nlGj61crwNdB4LakO0=; b=pViyF2rYBNiOnbRrQNw0NqNvo/69q4GLNmfeA0aVKtGplGv9pTYIpM6fdMn2EZfl+o IIbvRII+u8lxX5spmKvpjmY+dSzDsMviDAQPDysQoC5TOMFq3/hjjaQxceiNm9ndGCLr 7pIPyUhgofmO0C0qjArO0KBDZcUhYFPbnu9ap27mvja4APWiixkF9LbO96lRiz+UHfIw Rp0j7iLBe9C+GHbqdBdhd6eSct9OUc6P5Nd4RqFKuEDHvMC2WEjA5VIEWyQyUKnE1lMi 6/6rkhaQRW110OSjlkbZ8Xv4nWmLkt5GTTIvklS7/c2oflNpxswjSyroyEPUacxN9+UI GZHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=h7GMiEUFly34W6euhCTBI4Vi3nlGj61crwNdB4LakO0=; b=JkCYFidI0twzXIN7F/3CVM4qqzeXd4pSH9LwuywK4dR1x4u3L3xT2LImPZ0aEBjmCb JmCorgRK7A8bXqCncCk4FrXeyHpt8QPUAXmBS2w2ax+hH3sqIgJXwFgPnZK0pfm0auAE 73BGRHbd9sKRDjLjRIDluDW1WTAgNKMwwhe8R5DQF1iSeBApNJ7AaaxusG30iYUOULd8 3/M2kMI+fSTKFgQoFWlK6LsWr4/sHDVwVT6aq9VEaovWjo6fDGRa/Y/9uSJXuloUp8Qj iDuN8L0+A+WxQvp1MczXcI4AuKXrjybkAfh7uM3YKEbrnHFqVWnUxBYDOu4/9jSRiT8o 1ayg== X-Gm-Message-State: AOAM532kDSXt0ngDUibIiSUUhDCFECfg+69lwJhdqtdXZSTXVf7lFlHN Edj6anP8gy6/vhxg4weCb8LZyYhx X-Google-Smtp-Source: ABdhPJzRIP/gIQo9Dk0GcBQy1zrppFa20rhEprLSvKmfuvBPPCoKOLkwLd5wn1KmtvIs+o+ibZtKtg== X-Received: by 2002:aa7:9293:: with SMTP id j19mr10050340pfa.96.1591374380248; Fri, 05 Jun 2020 09:26:20 -0700 (PDT) Received: from localhost.localdomain ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id b29sm86205pff.176.2020.06.05.09.26.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Jun 2020 09:26:19 -0700 (PDT) From: Florian Fainelli X-Google-Original-From: Florian Fainelli To: linux-kernel@vger.kernel.org Cc: stable@vger.kernel.org, Mauro Carvalho Chehab , Florian Fainelli , Mauro Carvalho Chehab , Michael Krufky , Alexander Viro , Shuah Khan , Jaedon Shin , Colin Ian King , Katsuhiro Suzuki , Satendra Singh Thakur , linux-media@vger.kernel.org (open list:MEDIA INPUT INFRASTRUCTURE (V4L/DVB)), linux-fsdevel@vger.kernel.org (open list:FILESYSTEMS (VFS and infrastructure)) Subject: [PATCH stable 4.9 11/21] media: dvb_frontend: cleanup ioctl handling logic Date: Fri, 5 Jun 2020 09:25:08 -0700 Message-Id: <20200605162518.28099-12-florian.fainelli@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200605162518.28099-1-florian.fainelli@broadcom.com> References: <20200605162518.28099-1-florian.fainelli@broadcom.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org From: Mauro Carvalho Chehab commit d73dcf0cdb95a47f7e4e991ab63dd30f6eb67b4e upstream Currently, there are two handlers for ioctls: - dvb_frontend_ioctl_properties() - dvb_frontend_ioctl_legacy() Despite their names, both handles non-legacy DVB ioctls. Besides that, there's no reason why to not handle all ioctls on a single handler function. So, merge them into a single function (dvb_frontend_handle_ioctl) and reorganize the ioctl's to indicate what's the current DVB API and what's deprecated. Despite the big diff, the handling logic for each ioctl is the same as before. Reviewed-by: Shuah Khan Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Florian Fainelli --- drivers/media/dvb-core/dvb_frontend.c | 328 +++++++++++++------------- 1 file changed, 158 insertions(+), 170 deletions(-) diff --git a/drivers/media/dvb-core/dvb_frontend.c b/drivers/media/dvb-core/dvb_frontend.c index c446f51be21a..5b06ac91420f 100644 --- a/drivers/media/dvb-core/dvb_frontend.c +++ b/drivers/media/dvb-core/dvb_frontend.c @@ -1296,10 +1296,8 @@ static int dtv_get_frontend(struct dvb_frontend *fe, return 0; } -static int dvb_frontend_ioctl_legacy(struct file *file, - unsigned int cmd, void *parg); -static int dvb_frontend_ioctl_properties(struct file *file, - unsigned int cmd, void *parg); +static int dvb_frontend_handle_ioctl(struct file *file, + unsigned int cmd, void *parg); static int dtv_property_process_get(struct dvb_frontend *fe, const struct dtv_frontend_properties *c, @@ -1801,12 +1799,12 @@ static int dtv_property_process_set(struct dvb_frontend *fe, break; case DTV_VOLTAGE: c->voltage = tvp->u.data; - r = dvb_frontend_ioctl_legacy(file, FE_SET_VOLTAGE, + r = dvb_frontend_handle_ioctl(file, FE_SET_VOLTAGE, (void *)c->voltage); break; case DTV_TONE: c->sectone = tvp->u.data; - r = dvb_frontend_ioctl_legacy(file, FE_SET_TONE, + r = dvb_frontend_handle_ioctl(file, FE_SET_TONE, (void *)c->sectone); break; case DTV_CODE_RATE_HP: @@ -1913,14 +1911,13 @@ static int dtv_property_process_set(struct dvb_frontend *fe, return r; } -static int dvb_frontend_ioctl(struct file *file, - unsigned int cmd, void *parg) +static int dvb_frontend_ioctl(struct file *file, unsigned int cmd, void *parg) { struct dvb_device *dvbdev = file->private_data; struct dvb_frontend *fe = dvbdev->priv; struct dtv_frontend_properties *c = &fe->dtv_property_cache; struct dvb_frontend_private *fepriv = fe->frontend_priv; - int err = -EOPNOTSUPP; + int err; dev_dbg(fe->dvb->device, "%s: (%d)\n", __func__, _IOC_NR(cmd)); if (down_interruptible(&fepriv->sem)) @@ -1938,121 +1935,13 @@ static int dvb_frontend_ioctl(struct file *file, return -EPERM; } - if ((cmd == FE_SET_PROPERTY) || (cmd == FE_GET_PROPERTY)) - err = dvb_frontend_ioctl_properties(file, cmd, parg); - else { - c->state = DTV_UNDEFINED; - err = dvb_frontend_ioctl_legacy(file, cmd, parg); - } + c->state = DTV_UNDEFINED; + err = dvb_frontend_handle_ioctl(file, cmd, parg); up(&fepriv->sem); return err; } -static int dvb_frontend_ioctl_properties(struct file *file, - unsigned int cmd, void *parg) -{ - struct dvb_device *dvbdev = file->private_data; - struct dvb_frontend *fe = dvbdev->priv; - struct dvb_frontend_private *fepriv = fe->frontend_priv; - struct dtv_frontend_properties *c = &fe->dtv_property_cache; - int err, i; - - dev_dbg(fe->dvb->device, "%s:\n", __func__); - - switch(cmd) { - case FE_SET_PROPERTY: { - struct dtv_properties *tvps = parg; - struct dtv_property *tvp = NULL; - - dev_dbg(fe->dvb->device, "%s: properties.num = %d\n", - __func__, tvps->num); - dev_dbg(fe->dvb->device, "%s: properties.props = %p\n", - __func__, tvps->props); - - /* - * Put an arbitrary limit on the number of messages that can - * be sent at once - */ - if (!tvps->num || (tvps->num > DTV_IOCTL_MAX_MSGS)) - return -EINVAL; - - tvp = memdup_user(tvps->props, tvps->num * sizeof(*tvp)); - if (IS_ERR(tvp)) - return PTR_ERR(tvp); - - for (i = 0; i < tvps->num; i++) { - err = dtv_property_process_set(fe, tvp + i, file); - if (err < 0) { - kfree(tvp); - return err; - } - (tvp + i)->result = err; - } - - if (c->state == DTV_TUNE) - dev_dbg(fe->dvb->device, "%s: Property cache is full, tuning\n", __func__); - - kfree(tvp); - break; - } - case FE_GET_PROPERTY: { - struct dtv_properties *tvps = parg; - struct dtv_property *tvp = NULL; - struct dtv_frontend_properties getp = fe->dtv_property_cache; - - dev_dbg(fe->dvb->device, "%s: properties.num = %d\n", - __func__, tvps->num); - dev_dbg(fe->dvb->device, "%s: properties.props = %p\n", - __func__, tvps->props); - - /* - * Put an arbitrary limit on the number of messages that can - * be sent at once - */ - if (!tvps->num || (tvps->num > DTV_IOCTL_MAX_MSGS)) - return -EINVAL; - - tvp = memdup_user(tvps->props, tvps->num * sizeof(*tvp)); - if (IS_ERR(tvp)) - return PTR_ERR(tvp); - - /* - * Let's use our own copy of property cache, in order to - * avoid mangling with DTV zigzag logic, as drivers might - * return crap, if they don't check if the data is available - * before updating the properties cache. - */ - if (fepriv->state != FESTATE_IDLE) { - err = dtv_get_frontend(fe, &getp, NULL); - if (err < 0) { - kfree(tvp); - return err; - } - } - for (i = 0; i < tvps->num; i++) { - err = dtv_property_process_get(fe, &getp, tvp + i, file); - if (err < 0) { - kfree(tvp); - return err; - } - (tvp + i)->result = err; - } - - if (copy_to_user((void __user *)tvps->props, tvp, - tvps->num * sizeof(struct dtv_property))) { - kfree(tvp); - return -EFAULT; - } - kfree(tvp); - break; - } - default: - return -ENOTSUPP; - } /* switch */ - return 0; -} - static int dtv_set_frontend(struct dvb_frontend *fe) { struct dvb_frontend_private *fepriv = fe->frontend_priv; @@ -2190,16 +2079,105 @@ static int dtv_set_frontend(struct dvb_frontend *fe) } -static int dvb_frontend_ioctl_legacy(struct file *file, - unsigned int cmd, void *parg) +static int dvb_frontend_handle_ioctl(struct file *file, + unsigned int cmd, void *parg) { struct dvb_device *dvbdev = file->private_data; struct dvb_frontend *fe = dvbdev->priv; struct dvb_frontend_private *fepriv = fe->frontend_priv; struct dtv_frontend_properties *c = &fe->dtv_property_cache; - int err = -EOPNOTSUPP; + int i, err; + + dev_dbg(fe->dvb->device, "%s:\n", __func__); + + switch(cmd) { + case FE_SET_PROPERTY: { + struct dtv_properties *tvps = parg; + struct dtv_property *tvp = NULL; + + dev_dbg(fe->dvb->device, "%s: properties.num = %d\n", + __func__, tvps->num); + dev_dbg(fe->dvb->device, "%s: properties.props = %p\n", + __func__, tvps->props); + + /* + * Put an arbitrary limit on the number of messages that can + * be sent at once + */ + if (!tvps->num || (tvps->num > DTV_IOCTL_MAX_MSGS)) + return -EINVAL; + + tvp = memdup_user(tvps->props, tvps->num * sizeof(*tvp)); + if (IS_ERR(tvp)) + return PTR_ERR(tvp); + + for (i = 0; i < tvps->num; i++) { + err = dtv_property_process_set(fe, tvp + i, file); + if (err < 0) { + kfree(tvp); + return err; + } + (tvp + i)->result = err; + } + + if (c->state == DTV_TUNE) + dev_dbg(fe->dvb->device, "%s: Property cache is full, tuning\n", __func__); + + kfree(tvp); + break; + } + case FE_GET_PROPERTY: { + struct dtv_properties *tvps = parg; + struct dtv_property *tvp = NULL; + struct dtv_frontend_properties getp = fe->dtv_property_cache; + + dev_dbg(fe->dvb->device, "%s: properties.num = %d\n", + __func__, tvps->num); + dev_dbg(fe->dvb->device, "%s: properties.props = %p\n", + __func__, tvps->props); + + /* + * Put an arbitrary limit on the number of messages that can + * be sent at once + */ + if (!tvps->num || (tvps->num > DTV_IOCTL_MAX_MSGS)) + return -EINVAL; + + tvp = memdup_user(tvps->props, tvps->num * sizeof(*tvp)); + if (IS_ERR(tvp)) + return PTR_ERR(tvp); + + /* + * Let's use our own copy of property cache, in order to + * avoid mangling with DTV zigzag logic, as drivers might + * return crap, if they don't check if the data is available + * before updating the properties cache. + */ + if (fepriv->state != FESTATE_IDLE) { + err = dtv_get_frontend(fe, &getp, NULL); + if (err < 0) { + kfree(tvp); + return err; + } + } + for (i = 0; i < tvps->num; i++) { + err = dtv_property_process_get(fe, &getp, tvp + i, file); + if (err < 0) { + kfree(tvp); + return err; + } + (tvp + i)->result = err; + } + + if (copy_to_user((void __user *)tvps->props, tvp, + tvps->num * sizeof(struct dtv_property))) { + kfree(tvp); + return -EFAULT; + } + kfree(tvp); + break; + } - switch (cmd) { case FE_GET_INFO: { struct dvb_frontend_info* info = parg; @@ -2263,42 +2241,6 @@ static int dvb_frontend_ioctl_legacy(struct file *file, break; } - case FE_READ_BER: - if (fe->ops.read_ber) { - if (fepriv->thread) - err = fe->ops.read_ber(fe, (__u32 *) parg); - else - err = -EAGAIN; - } - break; - - case FE_READ_SIGNAL_STRENGTH: - if (fe->ops.read_signal_strength) { - if (fepriv->thread) - err = fe->ops.read_signal_strength(fe, (__u16 *) parg); - else - err = -EAGAIN; - } - break; - - case FE_READ_SNR: - if (fe->ops.read_snr) { - if (fepriv->thread) - err = fe->ops.read_snr(fe, (__u16 *) parg); - else - err = -EAGAIN; - } - break; - - case FE_READ_UNCORRECTED_BLOCKS: - if (fe->ops.read_ucblocks) { - if (fepriv->thread) - err = fe->ops.read_ucblocks(fe, (__u32 *) parg); - else - err = -EAGAIN; - } - break; - case FE_DISEQC_RESET_OVERLOAD: if (fe->ops.diseqc_reset_overload) { err = fe->ops.diseqc_reset_overload(fe); @@ -2350,6 +2292,23 @@ static int dvb_frontend_ioctl_legacy(struct file *file, } break; + case FE_DISEQC_RECV_SLAVE_REPLY: + if (fe->ops.diseqc_recv_slave_reply) + err = fe->ops.diseqc_recv_slave_reply(fe, (struct dvb_diseqc_slave_reply*) parg); + break; + + case FE_ENABLE_HIGH_LNB_VOLTAGE: + if (fe->ops.enable_high_lnb_voltage) + err = fe->ops.enable_high_lnb_voltage(fe, (long) parg); + break; + + case FE_SET_FRONTEND_TUNE_MODE: + fepriv->tune_mode_flags = (unsigned long) parg; + err = 0; + break; + + /* DEPRECATED dish control ioctls */ + case FE_DISHNETWORK_SEND_LEGACY_CMD: if (fe->ops.dishnetwork_send_legacy_command) { err = fe->ops.dishnetwork_send_legacy_command(fe, @@ -2414,16 +2373,46 @@ static int dvb_frontend_ioctl_legacy(struct file *file, } break; - case FE_DISEQC_RECV_SLAVE_REPLY: - if (fe->ops.diseqc_recv_slave_reply) - err = fe->ops.diseqc_recv_slave_reply(fe, (struct dvb_diseqc_slave_reply*) parg); + /* DEPRECATED statistics ioctls */ + + case FE_READ_BER: + if (fe->ops.read_ber) { + if (fepriv->thread) + err = fe->ops.read_ber(fe, (__u32 *) parg); + else + err = -EAGAIN; + } break; - case FE_ENABLE_HIGH_LNB_VOLTAGE: - if (fe->ops.enable_high_lnb_voltage) - err = fe->ops.enable_high_lnb_voltage(fe, (long) parg); + case FE_READ_SIGNAL_STRENGTH: + if (fe->ops.read_signal_strength) { + if (fepriv->thread) + err = fe->ops.read_signal_strength(fe, (__u16 *) parg); + else + err = -EAGAIN; + } + break; + + case FE_READ_SNR: + if (fe->ops.read_snr) { + if (fepriv->thread) + err = fe->ops.read_snr(fe, (__u16 *) parg); + else + err = -EAGAIN; + } + break; + + case FE_READ_UNCORRECTED_BLOCKS: + if (fe->ops.read_ucblocks) { + if (fepriv->thread) + err = fe->ops.read_ucblocks(fe, (__u32 *) parg); + else + err = -EAGAIN; + } break; + /* DEPRECATED DVBv3 ioctls */ + case FE_SET_FRONTEND: err = dvbv3_set_delivery_system(fe); if (err) @@ -2450,11 +2439,10 @@ static int dvb_frontend_ioctl_legacy(struct file *file, err = dtv_get_frontend(fe, &getp, parg); break; } - case FE_SET_FRONTEND_TUNE_MODE: - fepriv->tune_mode_flags = (unsigned long) parg; - err = 0; - break; - } + + default: + return -ENOTSUPP; + } /* switch */ return err; } From patchwork Fri Jun 5 16:25:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 11589983 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C5C1C913 for ; Fri, 5 Jun 2020 16:26:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A71D520810 for ; Fri, 5 Jun 2020 16:26:30 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="M1JlK4tQ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727878AbgFEQ00 (ORCPT ); Fri, 5 Jun 2020 12:26:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40800 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727809AbgFEQ0Y (ORCPT ); Fri, 5 Jun 2020 12:26:24 -0400 Received: from mail-pj1-x1041.google.com (mail-pj1-x1041.google.com [IPv6:2607:f8b0:4864:20::1041]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5DD5CC08C5C5; Fri, 5 Jun 2020 09:26:23 -0700 (PDT) Received: by mail-pj1-x1041.google.com with SMTP id d6so2952395pjs.3; Fri, 05 Jun 2020 09:26:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=v5IOrrmsw2Ix66TCmCMcm2Pl0TMPhGeFMZv/aXa4SS0=; b=M1JlK4tQHFdZH704MwVEdnAoKoFqWdJssJoX1Ame5iJ48b3/qvi/bmJIOjvW6WRAvg gLQhoUOVpNPne3tZod93kIU6Htcx2jatghV91n6J+P21CgSVpzzRFloTeRi/BxFdX+hX bXLfA5Nfe+031V2WkcsmHlY6p6qONfocyrBp7x4Fh7PRycz1M1pdL7LyJoMZCUuVlOID XZ2D8wWNFY+Lc95iLMrsGJ6sRWgfsowE2TR088ONxAMvhSHo6Su8SMBtBVoxO+IXFBLN drAwBTWSzlMKQLuqFhOXZpEi8mLY1Mr7F8IKQa2dcth5rgT4CNY6qP0goi80W95t9joB UrbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=v5IOrrmsw2Ix66TCmCMcm2Pl0TMPhGeFMZv/aXa4SS0=; b=fZrT+ANU5bczDt9araJ7NJ7Pc5/6B0nl+C0lKUkHyqYBklUo6k+UxY49T4SjiQCnwp TKUWDJYsKdD22sYysTx0KYA4LiHYFfvUYcr7LWsR/FmRIqFyx6o4R76eN1RoOJ2nBEIr bVETUB/LB+ND0josFOe4A63wtInDkNgE8jXbB3mTmMBCvlgDrX75F6C4ZP16bwBLE6kx /kSBmF8tR7dnX/qrIKYwcRyumKE/z/tuSGXutn6afnOnYNVwOnti6nyIKh4d1VEEIs/c LnZFQgdihQPq43nWZQ4azwIU9voIlEzX4Y7DsnA10nJeVjVbBjmP+QZQ84IBgNPNcsdA St7g== X-Gm-Message-State: AOAM531ZgBFPhk7n8GJQ/VHrXfXUJHVeAEpLufLMxSmH+XR10K10V54Y yTZ8As55RAKd5aMAW9mk4ZokQ1cq X-Google-Smtp-Source: ABdhPJyAj9y16c4QVaURhoARZXRcdAJJtG87fOtiOrpNgLjPKM36ZQoWAenVdogTmkYv/GWNXhfjcg== X-Received: by 2002:a17:90a:fe83:: with SMTP id co3mr3871871pjb.204.1591374382469; Fri, 05 Jun 2020 09:26:22 -0700 (PDT) Received: from localhost.localdomain ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id b29sm86205pff.176.2020.06.05.09.26.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Jun 2020 09:26:21 -0700 (PDT) From: Florian Fainelli X-Google-Original-From: Florian Fainelli To: linux-kernel@vger.kernel.org Cc: stable@vger.kernel.org, Mauro Carvalho Chehab , Florian Fainelli , Mauro Carvalho Chehab , Michael Krufky , Alexander Viro , Shuah Khan , Jaedon Shin , Colin Ian King , Katsuhiro Suzuki , Satendra Singh Thakur , linux-media@vger.kernel.org (open list:MEDIA INPUT INFRASTRUCTURE (V4L/DVB)), linux-fsdevel@vger.kernel.org (open list:FILESYSTEMS (VFS and infrastructure)) Subject: [PATCH stable 4.9 12/21] media: dvb_frontend: get rid of property cache's state Date: Fri, 5 Jun 2020 09:25:09 -0700 Message-Id: <20200605162518.28099-13-florian.fainelli@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200605162518.28099-1-florian.fainelli@broadcom.com> References: <20200605162518.28099-1-florian.fainelli@broadcom.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org From: Mauro Carvalho Chehab commit ef2cc27cf860b79874e9fde1419dd67c3372e41c upstream In the past, I guess the idea was to use state in order to allow an autofush logic. However, in the current code, it is used only for debug messages, on a poor man's solution, as there's already a debug message to indicate when the properties got flushed. So, just get rid of it for good. Reviewed-by: Shuah Khan Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Florian Fainelli --- drivers/media/dvb-core/dvb_frontend.c | 20 ++++++-------------- drivers/media/dvb-core/dvb_frontend.h | 5 ----- 2 files changed, 6 insertions(+), 19 deletions(-) diff --git a/drivers/media/dvb-core/dvb_frontend.c b/drivers/media/dvb-core/dvb_frontend.c index 5b06ac91420f..a7ba8e200b67 100644 --- a/drivers/media/dvb-core/dvb_frontend.c +++ b/drivers/media/dvb-core/dvb_frontend.c @@ -932,8 +932,6 @@ static int dvb_frontend_clear_cache(struct dvb_frontend *fe) memset(c, 0, offsetof(struct dtv_frontend_properties, strength)); c->delivery_system = delsys; - c->state = DTV_CLEAR; - dev_dbg(fe->dvb->device, "%s: Clearing cache for delivery system %d\n", __func__, c->delivery_system); @@ -1760,13 +1758,13 @@ static int dtv_property_process_set(struct dvb_frontend *fe, dvb_frontend_clear_cache(fe); break; case DTV_TUNE: - /* interpret the cache of data, build either a traditional frontend - * tunerequest so we can pass validation in the FE_SET_FRONTEND - * ioctl. + /* + * Use the cached Digital TV properties to tune the + * frontend */ - c->state = tvp->cmd; - dev_dbg(fe->dvb->device, "%s: Finalised property cache\n", - __func__); + dev_dbg(fe->dvb->device, + "%s: Setting the frontend from property cache\n", + __func__); r = dtv_set_frontend(fe); break; @@ -1915,7 +1913,6 @@ static int dvb_frontend_ioctl(struct file *file, unsigned int cmd, void *parg) { struct dvb_device *dvbdev = file->private_data; struct dvb_frontend *fe = dvbdev->priv; - struct dtv_frontend_properties *c = &fe->dtv_property_cache; struct dvb_frontend_private *fepriv = fe->frontend_priv; int err; @@ -1935,7 +1932,6 @@ static int dvb_frontend_ioctl(struct file *file, unsigned int cmd, void *parg) return -EPERM; } - c->state = DTV_UNDEFINED; err = dvb_frontend_handle_ioctl(file, cmd, parg); up(&fepriv->sem); @@ -2119,10 +2115,6 @@ static int dvb_frontend_handle_ioctl(struct file *file, } (tvp + i)->result = err; } - - if (c->state == DTV_TUNE) - dev_dbg(fe->dvb->device, "%s: Property cache is full, tuning\n", __func__); - kfree(tvp); break; } diff --git a/drivers/media/dvb-core/dvb_frontend.h b/drivers/media/dvb-core/dvb_frontend.h index f852f0a49f42..8a6267ad56d6 100644 --- a/drivers/media/dvb-core/dvb_frontend.h +++ b/drivers/media/dvb-core/dvb_frontend.h @@ -615,11 +615,6 @@ struct dtv_frontend_properties { struct dtv_fe_stats post_bit_count; struct dtv_fe_stats block_error; struct dtv_fe_stats block_count; - - /* private: */ - /* Cache State */ - u32 state; - }; #define DVB_FE_NO_EXIT 0 From patchwork Fri Jun 5 16:25:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 11590017 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id ABECC618 for ; Fri, 5 Jun 2020 16:27:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 945B8207ED for ; Fri, 5 Jun 2020 16:27:42 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="s00v2Cjn" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728501AbgFEQ1l (ORCPT ); Fri, 5 Jun 2020 12:27:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40808 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727834AbgFEQ0Z (ORCPT ); Fri, 5 Jun 2020 12:26:25 -0400 Received: from mail-pl1-x641.google.com (mail-pl1-x641.google.com [IPv6:2607:f8b0:4864:20::641]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6203DC08C5C2; Fri, 5 Jun 2020 09:26:25 -0700 (PDT) Received: by mail-pl1-x641.google.com with SMTP id v24so3825406plo.6; Fri, 05 Jun 2020 09:26:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=BLnQZOuB1encvsP/q1TibKnbvwfFTQgmw900uUD1eh0=; b=s00v2CjnBugUosRS98w1/0sNO2ock4FIvKSRMeLbUSssi7MVlHqvLRq37Hjfdu22ms tP1LS3GniNPJjGdPKLPZVTVkFDCzLVAoaI0pMCwQHV/Ngof36A3Q+h7zeR+ccoudD/qQ MKu1OGIJQ7QCrxE7shBQmY7Qat23pA3t8ePzKPjLhon9U0+Npv6RHCdngwIw9+Eq0iGv PxEM4xr3gSFjtCrrvI2Yt3uACQLm2sRXUjffqBV4VJfm4iBP7iGNz4mz3B65CuWe2muA /gsUYtk61NiJtjU8fPiM7dotWk3b0Fuu28+xAj5o0+pvrPuihVoBj60Mv9VOW9aWucfF bfmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=BLnQZOuB1encvsP/q1TibKnbvwfFTQgmw900uUD1eh0=; b=kmy1aTy+mMGMYkyYwSN4/Duc3b39SYjJuhPFdzwERSxJCVtlDcuqGYVvtpxMXVBP0j PVw0vGzNRoPuSR7FJFDYKs79Y65a3gb4Wc3YJ9luZOrEbqqb5fwZHTpzls2IoOd7AP6v tJyb0hCTYJdC1Q/sgzHmioy1NNOYpBoU5vPROZUiGRZmHx8QECm20o5L7R03vnimdWoi S6BQ6iFgE3dsGhYTyNb6+yvUhU+uQtyDD/8hX3h1MgozeJbcE68T0ACWeXTfcsVtZDQP KdiHvSIffaZj9NgyMwPhCpo1L4NYonBLzq7Li+iiwVVHrk7rFSSSZoy+tMokFUN3aHWb /BZg== X-Gm-Message-State: AOAM533IU8Mts4H0c8VXW98H80oXQj7cxgxMve7Yo+kJfWc77qBkbXMC FFkS5kJyLdIrv6eRL9XrXpggCdOv X-Google-Smtp-Source: ABdhPJz0cVn1eGekoeOqU4W06zaqiKvd2KFHArWEsQz0WH9fUXfaO5hFFKYjAhl9h/p0Nup6qACHKQ== X-Received: by 2002:a17:90a:17ed:: with SMTP id q100mr3639794pja.80.1591374384508; Fri, 05 Jun 2020 09:26:24 -0700 (PDT) Received: from localhost.localdomain ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id b29sm86205pff.176.2020.06.05.09.26.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Jun 2020 09:26:23 -0700 (PDT) From: Florian Fainelli X-Google-Original-From: Florian Fainelli To: linux-kernel@vger.kernel.org Cc: stable@vger.kernel.org, Mauro Carvalho Chehab , Florian Fainelli , Mauro Carvalho Chehab , Michael Krufky , Alexander Viro , Shuah Khan , Jaedon Shin , Colin Ian King , Katsuhiro Suzuki , Satendra Singh Thakur , linux-media@vger.kernel.org (open list:MEDIA INPUT INFRASTRUCTURE (V4L/DVB)), linux-fsdevel@vger.kernel.org (open list:FILESYSTEMS (VFS and infrastructure)) Subject: [PATCH stable 4.9 13/21] media: dvb_frontend: better document the -EPERM condition Date: Fri, 5 Jun 2020 09:25:10 -0700 Message-Id: <20200605162518.28099-14-florian.fainelli@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200605162518.28099-1-florian.fainelli@broadcom.com> References: <20200605162518.28099-1-florian.fainelli@broadcom.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org From: Mauro Carvalho Chehab commit da5516b5e81d45a96291823620f6c820178dc055 upstream Two readonly ioctls can't be allowed if the frontend device is opened in read only mode. Explain why. Reviewed by: Shuah Khan Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Florian Fainelli --- drivers/media/dvb-core/dvb_frontend.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/drivers/media/dvb-core/dvb_frontend.c b/drivers/media/dvb-core/dvb_frontend.c index a7ba8e200b67..673cefb7230c 100644 --- a/drivers/media/dvb-core/dvb_frontend.c +++ b/drivers/media/dvb-core/dvb_frontend.c @@ -1925,9 +1925,23 @@ static int dvb_frontend_ioctl(struct file *file, unsigned int cmd, void *parg) return -ENODEV; } - if ((file->f_flags & O_ACCMODE) == O_RDONLY && - (_IOC_DIR(cmd) != _IOC_READ || cmd == FE_GET_EVENT || - cmd == FE_DISEQC_RECV_SLAVE_REPLY)) { + /* + * If the frontend is opened in read-only mode, only the ioctls + * that don't interfere with the tune logic should be accepted. + * That allows an external application to monitor the DVB QoS and + * statistics parameters. + * + * That matches all _IOR() ioctls, except for two special cases: + * - FE_GET_EVENT is part of the tuning logic on a DVB application; + * - FE_DISEQC_RECV_SLAVE_REPLY is part of DiSEqC 2.0 + * setup + * So, those two ioctls should also return -EPERM, as otherwise + * reading from them would interfere with a DVB tune application + */ + if ((file->f_flags & O_ACCMODE) == O_RDONLY + && (_IOC_DIR(cmd) != _IOC_READ + || cmd == FE_GET_EVENT + || cmd == FE_DISEQC_RECV_SLAVE_REPLY)) { up(&fepriv->sem); return -EPERM; } From patchwork Fri Jun 5 16:25:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 11590011 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 57667618 for ; Fri, 5 Jun 2020 16:27:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 33F0D2077D for ; Fri, 5 Jun 2020 16:27:23 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ts5wD8M/" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728009AbgFEQ0a (ORCPT ); Fri, 5 Jun 2020 12:26:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40814 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727911AbgFEQ01 (ORCPT ); Fri, 5 Jun 2020 12:26:27 -0400 Received: from mail-pf1-x442.google.com (mail-pf1-x442.google.com [IPv6:2607:f8b0:4864:20::442]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C26D2C08C5C2; Fri, 5 Jun 2020 09:26:27 -0700 (PDT) Received: by mail-pf1-x442.google.com with SMTP id 64so5121189pfg.8; Fri, 05 Jun 2020 09:26:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=fLC8ozHHD0gNLLpBMnipIeglQHpIP8kwdagjdUrQSk4=; b=ts5wD8M/CLvw5rFgWQOpEpZs+0bpNGvwnfCyJ9AvBGS0fE/2B5cD0NUNDBZLWa2mX1 otli6eRczJOCZevkJse05B4/51bSarTIpB9/l7ucZtsWl+qfFz15nebCjlCv3aabAqkp WwOKY2UcRdi+8Uwa5Xgo473mWsbhCBFRrPsenTb9wolVQVeWHJfLhA7xLMWAsYOg/zLd MY3isdxgYcLp8lvbmMHlYf1/ghAJiUA/+9WBd+iE9C66NInKnN05rLbiw5AqTwKBtnff vnbijBHXg/JHUfQkGd0AY8EPtg7NckOw2ZV93MtseczXmvGN4rnqx3syThtsZUlUKLGM UjRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=fLC8ozHHD0gNLLpBMnipIeglQHpIP8kwdagjdUrQSk4=; b=OahI7V5K4gFw02rSQdXIS/eUb8r9tljJPBngH4aCDRn4zlNoNQAwD29mGOKwm1uAMH DxpEJvj+2SFRKGdP6zeUbiHLp5Soz6W+f6sEsoQeaig9Isa8/pyM4cLkGcQNSIIv3OaX IGvI3lRf1ulnlx4bUWQjy6YV5j5MfwGxXworWEI31c+bkgCmCiddCiFoEvfukNhVg/u/ viH9betL4XZPowrWTqHu9505SRbNX5yHp6/WtEUlPDWIsKnaCBEvGRlajk7HrVrUl2wM seWxn4ukBRHbGwG2gFg65ZH0ivH1n93+ShdyvnCiL5jbtss0yDsuScGBIvky/p6U3XxE V9xw== X-Gm-Message-State: AOAM531JYkOvs+But7H0PinoWXJ0E4fAYUefGUSGqE5IwM2KLfggr9vZ BewyhuJIm/EBcEcQJ4b1q55hjN63 X-Google-Smtp-Source: ABdhPJxdkh+JW2AdAReGmO8hX2+/p42zwlaTalOmne2KEyBkpFSRNadjnUzuVcW0qDCTlqziozaung== X-Received: by 2002:a62:7841:: with SMTP id t62mr9955304pfc.273.1591374386823; Fri, 05 Jun 2020 09:26:26 -0700 (PDT) Received: from localhost.localdomain ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id b29sm86205pff.176.2020.06.05.09.26.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Jun 2020 09:26:25 -0700 (PDT) From: Florian Fainelli X-Google-Original-From: Florian Fainelli To: linux-kernel@vger.kernel.org Cc: stable@vger.kernel.org, Mauro Carvalho Chehab , Florian Fainelli , Mauro Carvalho Chehab , Michael Krufky , Alexander Viro , Shuah Khan , Jaedon Shin , Colin Ian King , Katsuhiro Suzuki , Satendra Singh Thakur , linux-media@vger.kernel.org (open list:MEDIA INPUT INFRASTRUCTURE (V4L/DVB)), linux-fsdevel@vger.kernel.org (open list:FILESYSTEMS (VFS and infrastructure)) Subject: [PATCH stable 4.9 14/21] media: dvb_frontend: fix return values for FE_SET_PROPERTY Date: Fri, 5 Jun 2020 09:25:11 -0700 Message-Id: <20200605162518.28099-15-florian.fainelli@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200605162518.28099-1-florian.fainelli@broadcom.com> References: <20200605162518.28099-1-florian.fainelli@broadcom.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org From: Mauro Carvalho Chehab commit 259a41d9ae8f3689742267f340ad2b159d00b302 upstream There are several problems with regards to the return of FE_SET_PROPERTY. The original idea were to return per-property return codes via tvp->result field, and to return an updated set of values. However, that never worked. What's actually implemented is: - the FE_SET_PROPERTY implementation doesn't call .get_frontend callback in order to get the actual parameters after return; - the tvp->result field is only filled if there's no error. So, it is always filled with zero; - FE_SET_PROPERTY doesn't call memdup_user() nor any other copy_to_user() function. So, any changes to the properties will be lost; - FE_SET_PROPERTY is declared as a write-only ioctl (IOW). While we could fix the above, it could cause regressions. So, let's just assume what the code really does, updating the documentation accordingly and removing the logic that would update the discarded tvp->result. Reviewed-by: Shuah Khan Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Florian Fainelli --- Documentation/media/uapi/dvb/fe-get-property.rst | 7 +++++-- drivers/media/dvb-core/dvb_frontend.c | 2 -- include/uapi/linux/dvb/frontend.h | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Documentation/media/uapi/dvb/fe-get-property.rst b/Documentation/media/uapi/dvb/fe-get-property.rst index 015d4db597b5..c80c5fc6e916 100644 --- a/Documentation/media/uapi/dvb/fe-get-property.rst +++ b/Documentation/media/uapi/dvb/fe-get-property.rst @@ -48,8 +48,11 @@ depends on the delivery system and on the device: - This call requires read/write access to the device. - - At return, the values are updated to reflect the actual parameters - used. +.. note:: + + At return, the values aren't updated to reflect the actual + parameters used. If the actual parameters are needed, an explicit + call to ``FE_GET_PROPERTY`` is needed. - ``FE_GET_PROPERTY:`` diff --git a/drivers/media/dvb-core/dvb_frontend.c b/drivers/media/dvb-core/dvb_frontend.c index 673cefb7230c..ca4959bbb6c2 100644 --- a/drivers/media/dvb-core/dvb_frontend.c +++ b/drivers/media/dvb-core/dvb_frontend.c @@ -2127,7 +2127,6 @@ static int dvb_frontend_handle_ioctl(struct file *file, kfree(tvp); return err; } - (tvp + i)->result = err; } kfree(tvp); break; @@ -2172,7 +2171,6 @@ static int dvb_frontend_handle_ioctl(struct file *file, kfree(tvp); return err; } - (tvp + i)->result = err; } if (copy_to_user((void __user *)tvps->props, tvp, diff --git a/include/uapi/linux/dvb/frontend.h b/include/uapi/linux/dvb/frontend.h index 16a318fc469a..b653754ee9cf 100644 --- a/include/uapi/linux/dvb/frontend.h +++ b/include/uapi/linux/dvb/frontend.h @@ -830,7 +830,7 @@ struct dtv_fe_stats { * @cmd: Digital TV command. * @reserved: Not used. * @u: Union with the values for the command. - * @result: Result of the command set (currently unused). + * @result: Unused * * The @u union may have either one of the values below: * From patchwork Fri Jun 5 16:25:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 11590015 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A11801391 for ; Fri, 5 Jun 2020 16:27:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 835F720820 for ; Fri, 5 Jun 2020 16:27:24 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="kVNXoR7j" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728446AbgFEQ1X (ORCPT ); Fri, 5 Jun 2020 12:27:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40822 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727960AbgFEQ0a (ORCPT ); Fri, 5 Jun 2020 12:26:30 -0400 Received: from mail-pg1-x543.google.com (mail-pg1-x543.google.com [IPv6:2607:f8b0:4864:20::543]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DF578C08C5C3; Fri, 5 Jun 2020 09:26:29 -0700 (PDT) Received: by mail-pg1-x543.google.com with SMTP id r10so5335733pgv.8; Fri, 05 Jun 2020 09:26:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=+N3kHSDVqsZFY1+BCJ77exstXC1iacuDolQw5ImyaQI=; b=kVNXoR7jUWvZV/msL11C9fbekmco3642TFubX0dWjh6lDrDHirKHkcY6dO19O56c+h RtjFWh9cjQf00mWUUc8xslHZNWdQQIMi9Mjoh/BN143lUNMN+pTRZHAqIB9tabqCbuaZ tJzNhAUfnJAg/VmNAH178wr4lqs3rvXlM/c2pqk0GBze5R+3o1kwKtPuhPCF9Z8OaRZa aIItA4fJEDhQ6wYSllzILB5GsAIIv82A+Yj86tCvHOvDfWrEOOT3Hs4AHa2eNErnkkQA kbaMFEuWLrMdIY/hm08P+WxEkfhwe0OLoVha79XxrrgIzVOQV9W20ph1gF3up0E/BRMp 79Jw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=+N3kHSDVqsZFY1+BCJ77exstXC1iacuDolQw5ImyaQI=; b=gS3Jb7/lHoPpneQc6pc71DtRbfgnBhf7eOV+khoxE+Tktnk8BFmGJvqaT0xZluPddt DxC0XXMwfdm7q+Zlalq4vbMt9mU6zW1thrhj9JGAJYcoELRgjkXA/wHftSS+RRmGU/nW wRMTXdnBB9VLXthqZ4KdqffPohl6WVJRm0Gi2t5A10reWq7Elzl4PBGzpf1cr3S9ibwl +1ntNb4Yf2n1+byCfPQikfU2tMHDu9FzRQ6XvNVyIpCUUvSZIpEnWQ9xynZ445OSnBQz 38NrLzK47vbGTTGKzfGlYctAOe0wxPAlqBAQDJiE37gAzbHus9AUi1L5TyEG9mjI4Vk1 mlOA== X-Gm-Message-State: AOAM533DKg6HMHAF++DHNxS9bvwbOH/ytXCsA/gd2O9TwaMhrP6bitfh wAesygXblAB+bDIj1vnxCq5ngct7 X-Google-Smtp-Source: ABdhPJyk+hTQeHsRrR7Z4Qwxfy7FC+HeakH0C66nlgKJ0BthdauidvpXSGEw06q35gNh5jA6XnCTlA== X-Received: by 2002:a62:4e83:: with SMTP id c125mr11030510pfb.165.1591374388926; Fri, 05 Jun 2020 09:26:28 -0700 (PDT) Received: from localhost.localdomain ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id b29sm86205pff.176.2020.06.05.09.26.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Jun 2020 09:26:28 -0700 (PDT) From: Florian Fainelli X-Google-Original-From: Florian Fainelli To: linux-kernel@vger.kernel.org Cc: stable@vger.kernel.org, Satendra Singh Thakur , Mauro Carvalho Chehab , Florian Fainelli , Mauro Carvalho Chehab , Michael Krufky , Alexander Viro , Shuah Khan , Jaedon Shin , Colin Ian King , Katsuhiro Suzuki , linux-media@vger.kernel.org (open list:MEDIA INPUT INFRASTRUCTURE (V4L/DVB)), linux-fsdevel@vger.kernel.org (open list:FILESYSTEMS (VFS and infrastructure)) Subject: [PATCH stable 4.9 15/21] media: dvb_frontend: dtv_property_process_set() cleanups Date: Fri, 5 Jun 2020 09:25:12 -0700 Message-Id: <20200605162518.28099-16-florian.fainelli@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200605162518.28099-1-florian.fainelli@broadcom.com> References: <20200605162518.28099-1-florian.fainelli@broadcom.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org From: Satendra Singh Thakur commit media: dvb_frontend: dtv_property_process_set() cleanups upstream Since all properties in the func dtv_property_process_set() use at most 4 bytes arguments, change the code to pass u32 cmd and u32 data as function arguments, instead of passing a pointer to the entire struct dtv_property *tvp. Instead of having a generic dtv_property_dump(), added its own properties debug logic in the dtv_property_process_set(). Signed-off-by: Satendra Singh Thakur Reviewed-by: Shuah Khan Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Florian Fainelli --- drivers/media/dvb-core/dvb_frontend.c | 125 +++++++++++++++----------- 1 file changed, 72 insertions(+), 53 deletions(-) diff --git a/drivers/media/dvb-core/dvb_frontend.c b/drivers/media/dvb-core/dvb_frontend.c index ca4959bbb6c2..a9ae9e509205 100644 --- a/drivers/media/dvb-core/dvb_frontend.c +++ b/drivers/media/dvb-core/dvb_frontend.c @@ -1088,22 +1088,19 @@ static struct dtv_cmds_h dtv_cmds[DTV_MAX_COMMAND + 1] = { _DTV_CMD(DTV_STAT_TOTAL_BLOCK_COUNT, 0, 0), }; -static void dtv_property_dump(struct dvb_frontend *fe, - bool is_set, +static void dtv_get_property_dump(struct dvb_frontend *fe, struct dtv_property *tvp) { int i; if (tvp->cmd <= 0 || tvp->cmd > DTV_MAX_COMMAND) { - dev_warn(fe->dvb->device, "%s: %s tvp.cmd = 0x%08x undefined\n", - __func__, - is_set ? "SET" : "GET", + dev_warn(fe->dvb->device, "%s: GET tvp.cmd = 0x%08x undefined\n" + , __func__, tvp->cmd); return; } - dev_dbg(fe->dvb->device, "%s: %s tvp.cmd = 0x%08x (%s)\n", __func__, - is_set ? "SET" : "GET", + dev_dbg(fe->dvb->device, "%s: GET tvp.cmd = 0x%08x (%s)\n", __func__, tvp->cmd, dtv_cmds[tvp->cmd].name); @@ -1513,7 +1510,7 @@ static int dtv_property_process_get(struct dvb_frontend *fe, return -EINVAL; } - dtv_property_dump(fe, false, tvp); + dtv_get_property_dump(fe, tvp); return 0; } @@ -1740,16 +1737,36 @@ static int dvbv3_set_delivery_system(struct dvb_frontend *fe) return emulate_delivery_system(fe, delsys); } +/** + * dtv_property_process_set - Sets a single DTV property + * @fe: Pointer to &struct dvb_frontend + * @file: Pointer to &struct file + * @cmd: Digital TV command + * @data: An unsigned 32-bits number + * + * This routine assigns the property + * value to the corresponding member of + * &struct dtv_frontend_properties + * + * Returns: + * Zero on success, negative errno on failure. + */ static int dtv_property_process_set(struct dvb_frontend *fe, - struct dtv_property *tvp, - struct file *file) + struct file *file, + u32 cmd, u32 data) { int r = 0; struct dtv_frontend_properties *c = &fe->dtv_property_cache; - dtv_property_dump(fe, true, tvp); - - switch(tvp->cmd) { + /** Dump DTV command name and value*/ + if (!cmd || cmd > DTV_MAX_COMMAND) + dev_warn(fe->dvb->device, "%s: SET cmd 0x%08x undefined\n", + __func__, cmd); + else + dev_dbg(fe->dvb->device, + "%s: SET cmd 0x%08x (%s) to 0x%08x\n", + __func__, cmd, dtv_cmds[cmd].name, data); + switch (cmd) { case DTV_CLEAR: /* * Reset a cache of data specific to the frontend here. This does @@ -1769,133 +1786,133 @@ static int dtv_property_process_set(struct dvb_frontend *fe, r = dtv_set_frontend(fe); break; case DTV_FREQUENCY: - c->frequency = tvp->u.data; + c->frequency = data; break; case DTV_MODULATION: - c->modulation = tvp->u.data; + c->modulation = data; break; case DTV_BANDWIDTH_HZ: - c->bandwidth_hz = tvp->u.data; + c->bandwidth_hz = data; break; case DTV_INVERSION: - c->inversion = tvp->u.data; + c->inversion = data; break; case DTV_SYMBOL_RATE: - c->symbol_rate = tvp->u.data; + c->symbol_rate = data; break; case DTV_INNER_FEC: - c->fec_inner = tvp->u.data; + c->fec_inner = data; break; case DTV_PILOT: - c->pilot = tvp->u.data; + c->pilot = data; break; case DTV_ROLLOFF: - c->rolloff = tvp->u.data; + c->rolloff = data; break; case DTV_DELIVERY_SYSTEM: - r = dvbv5_set_delivery_system(fe, tvp->u.data); + r = dvbv5_set_delivery_system(fe, data); break; case DTV_VOLTAGE: - c->voltage = tvp->u.data; + c->voltage = data; r = dvb_frontend_handle_ioctl(file, FE_SET_VOLTAGE, (void *)c->voltage); break; case DTV_TONE: - c->sectone = tvp->u.data; + c->sectone = data; r = dvb_frontend_handle_ioctl(file, FE_SET_TONE, (void *)c->sectone); break; case DTV_CODE_RATE_HP: - c->code_rate_HP = tvp->u.data; + c->code_rate_HP = data; break; case DTV_CODE_RATE_LP: - c->code_rate_LP = tvp->u.data; + c->code_rate_LP = data; break; case DTV_GUARD_INTERVAL: - c->guard_interval = tvp->u.data; + c->guard_interval = data; break; case DTV_TRANSMISSION_MODE: - c->transmission_mode = tvp->u.data; + c->transmission_mode = data; break; case DTV_HIERARCHY: - c->hierarchy = tvp->u.data; + c->hierarchy = data; break; case DTV_INTERLEAVING: - c->interleaving = tvp->u.data; + c->interleaving = data; break; /* ISDB-T Support here */ case DTV_ISDBT_PARTIAL_RECEPTION: - c->isdbt_partial_reception = tvp->u.data; + c->isdbt_partial_reception = data; break; case DTV_ISDBT_SOUND_BROADCASTING: - c->isdbt_sb_mode = tvp->u.data; + c->isdbt_sb_mode = data; break; case DTV_ISDBT_SB_SUBCHANNEL_ID: - c->isdbt_sb_subchannel = tvp->u.data; + c->isdbt_sb_subchannel = data; break; case DTV_ISDBT_SB_SEGMENT_IDX: - c->isdbt_sb_segment_idx = tvp->u.data; + c->isdbt_sb_segment_idx = data; break; case DTV_ISDBT_SB_SEGMENT_COUNT: - c->isdbt_sb_segment_count = tvp->u.data; + c->isdbt_sb_segment_count = data; break; case DTV_ISDBT_LAYER_ENABLED: - c->isdbt_layer_enabled = tvp->u.data; + c->isdbt_layer_enabled = data; break; case DTV_ISDBT_LAYERA_FEC: - c->layer[0].fec = tvp->u.data; + c->layer[0].fec = data; break; case DTV_ISDBT_LAYERA_MODULATION: - c->layer[0].modulation = tvp->u.data; + c->layer[0].modulation = data; break; case DTV_ISDBT_LAYERA_SEGMENT_COUNT: - c->layer[0].segment_count = tvp->u.data; + c->layer[0].segment_count = data; break; case DTV_ISDBT_LAYERA_TIME_INTERLEAVING: - c->layer[0].interleaving = tvp->u.data; + c->layer[0].interleaving = data; break; case DTV_ISDBT_LAYERB_FEC: - c->layer[1].fec = tvp->u.data; + c->layer[1].fec = data; break; case DTV_ISDBT_LAYERB_MODULATION: - c->layer[1].modulation = tvp->u.data; + c->layer[1].modulation = data; break; case DTV_ISDBT_LAYERB_SEGMENT_COUNT: - c->layer[1].segment_count = tvp->u.data; + c->layer[1].segment_count = data; break; case DTV_ISDBT_LAYERB_TIME_INTERLEAVING: - c->layer[1].interleaving = tvp->u.data; + c->layer[1].interleaving = data; break; case DTV_ISDBT_LAYERC_FEC: - c->layer[2].fec = tvp->u.data; + c->layer[2].fec = data; break; case DTV_ISDBT_LAYERC_MODULATION: - c->layer[2].modulation = tvp->u.data; + c->layer[2].modulation = data; break; case DTV_ISDBT_LAYERC_SEGMENT_COUNT: - c->layer[2].segment_count = tvp->u.data; + c->layer[2].segment_count = data; break; case DTV_ISDBT_LAYERC_TIME_INTERLEAVING: - c->layer[2].interleaving = tvp->u.data; + c->layer[2].interleaving = data; break; /* Multistream support */ case DTV_STREAM_ID: case DTV_DVBT2_PLP_ID_LEGACY: - c->stream_id = tvp->u.data; + c->stream_id = data; break; /* ATSC-MH */ case DTV_ATSCMH_PARADE_ID: - fe->dtv_property_cache.atscmh_parade_id = tvp->u.data; + fe->dtv_property_cache.atscmh_parade_id = data; break; case DTV_ATSCMH_RS_FRAME_ENSEMBLE: - fe->dtv_property_cache.atscmh_rs_frame_ensemble = tvp->u.data; + fe->dtv_property_cache.atscmh_rs_frame_ensemble = data; break; case DTV_LNA: - c->lna = tvp->u.data; + c->lna = data; if (fe->ops.set_lna) r = fe->ops.set_lna(fe); if (r < 0) @@ -2122,7 +2139,9 @@ static int dvb_frontend_handle_ioctl(struct file *file, return PTR_ERR(tvp); for (i = 0; i < tvps->num; i++) { - err = dtv_property_process_set(fe, tvp + i, file); + err = dtv_property_process_set(fe, file, + (tvp + i)->cmd, + (tvp + i)->u.data); if (err < 0) { kfree(tvp); return err; From patchwork Fri Jun 5 16:25:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 11589999 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2E0EF618 for ; Fri, 5 Jun 2020 16:27:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 14EEE2086A for ; Fri, 5 Jun 2020 16:27:05 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="HAb4EpHZ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728249AbgFEQ0l (ORCPT ); Fri, 5 Jun 2020 12:26:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40832 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728024AbgFEQ0c (ORCPT ); Fri, 5 Jun 2020 12:26:32 -0400 Received: from mail-pf1-x444.google.com (mail-pf1-x444.google.com [IPv6:2607:f8b0:4864:20::444]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 26E80C08C5C4; Fri, 5 Jun 2020 09:26:32 -0700 (PDT) Received: by mail-pf1-x444.google.com with SMTP id d66so5131226pfd.6; Fri, 05 Jun 2020 09:26:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=wS0FplcEHKkha537ftRtmFe7oqwpBZmXOkXwoZ5YLM4=; b=HAb4EpHZ44cieamqBez4audEeYm3SXN4/aZbWIt2ZuhGrVTwrcBbtQqvGusVckRJvr ZhqX/bYEkRPiItVanv4svAFj7fTcYwKnAyGfmAK2Ra1yTR8x7mnsIzWyV4KuJc6uImJD vng4u5XZvV50sqQFzjOc6JhAyZ04VGwNvaWmYNP220hfRtv+67rFrRfQeCeHcdVC9RJV Vkemu6oMd430RJXXY6Nb9MOejIWqUjHXdTZDQ2OUMdrLINaN8eYzrUEhGa8lmtqqAX7a eWAyudL6idmnQTR5mwDt1gQJ8nzxXvFHnBZMETUY2gycPizY3e8FszasbBF66j891GtS FiOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=wS0FplcEHKkha537ftRtmFe7oqwpBZmXOkXwoZ5YLM4=; b=SwzUV7sM4OvmeexKmCQdO/a0LjTEnvNDFe6F5KSZJKlylTKoS5t8fm7fxumD1FBNxd qWTgpSxnz+vI3GhoCrydqe1+i1G1QZRD2bRCwBIR4v054BO+m95dePVrRhUue7LWl4CZ d/p7luuhHKQZg0bE2SHRph2lP0R7if0IRqR7j5CsOEs4Nz6qT2z2mTr6/Zmmi0FGq7DP 0fXd8w2cIJ0YkYOIgJijLp0qsDXwAxiJAwv6a4nwvKI8HCksxSVG+IxUZbdclhfnVdCB lbccsiccoGNjATtS8Idc6lm8AIAB9ALpkF6ccyDrUx8wse+Rc1yAyMDhCGV98t0HQcFI E8QQ== X-Gm-Message-State: AOAM531+bZu0+WYtjtLnApitF8dBqn0wH0zg9ud7fDkiRYIQTZump5qC xSYZf1CrrIzypqJfszBKX0jPpZ3M X-Google-Smtp-Source: ABdhPJzcYCZRxmnFkP119aIzW0clCUkfzwjLLEkg+1TcV+0cA27hNYWVx35erGXIXjHjGJqV3MeFiw== X-Received: by 2002:aa7:97bd:: with SMTP id d29mr9863623pfq.262.1591374391294; Fri, 05 Jun 2020 09:26:31 -0700 (PDT) Received: from localhost.localdomain ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id b29sm86205pff.176.2020.06.05.09.26.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Jun 2020 09:26:30 -0700 (PDT) From: Florian Fainelli X-Google-Original-From: Florian Fainelli To: linux-kernel@vger.kernel.org Cc: stable@vger.kernel.org, Mauro Carvalho Chehab , Florian Fainelli , Mauro Carvalho Chehab , Michael Krufky , Alexander Viro , Shuah Khan , Jaedon Shin , Colin Ian King , Katsuhiro Suzuki , Satendra Singh Thakur , linux-media@vger.kernel.org (open list:MEDIA INPUT INFRASTRUCTURE (V4L/DVB)), linux-fsdevel@vger.kernel.org (open list:FILESYSTEMS (VFS and infrastructure)) Subject: [PATCH stable 4.9 16/21] media: dvb_frontend: be sure to init dvb_frontend_handle_ioctl() return code Date: Fri, 5 Jun 2020 09:25:13 -0700 Message-Id: <20200605162518.28099-17-florian.fainelli@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200605162518.28099-1-florian.fainelli@broadcom.com> References: <20200605162518.28099-1-florian.fainelli@broadcom.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org From: Mauro Carvalho Chehab commit a9cb97c3e628902e37583d8a40bb28cf76522cf1 upstream As smatch warned: drivers/media/dvb-core/dvb_frontend.c:2468 dvb_frontend_handle_ioctl() error: uninitialized symbol 'err'. The ioctl handler actually got a regression here: before changeset d73dcf0cdb95 ("media: dvb_frontend: cleanup ioctl handling logic"), the code used to return -EOPNOTSUPP if an ioctl handler was not implemented on a driver. After the change, it may return a random value. Fixes: d73dcf0cdb95 ("media: dvb_frontend: cleanup ioctl handling logic") Cc: stable@vger.kernel.org Signed-off-by: Mauro Carvalho Chehab Tested-by: Daniel Scheller Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Florian Fainelli --- drivers/media/dvb-core/dvb_frontend.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/media/dvb-core/dvb_frontend.c b/drivers/media/dvb-core/dvb_frontend.c index a9ae9e509205..6f9ee78a1870 100644 --- a/drivers/media/dvb-core/dvb_frontend.c +++ b/drivers/media/dvb-core/dvb_frontend.c @@ -2113,7 +2113,7 @@ static int dvb_frontend_handle_ioctl(struct file *file, struct dvb_frontend *fe = dvbdev->priv; struct dvb_frontend_private *fepriv = fe->frontend_priv; struct dtv_frontend_properties *c = &fe->dtv_property_cache; - int i, err; + int i, err = -EOPNOTSUPP; dev_dbg(fe->dvb->device, "%s:\n", __func__); @@ -2148,6 +2148,7 @@ static int dvb_frontend_handle_ioctl(struct file *file, } } kfree(tvp); + err = 0; break; } case FE_GET_PROPERTY: { @@ -2198,6 +2199,7 @@ static int dvb_frontend_handle_ioctl(struct file *file, return -EFAULT; } kfree(tvp); + err = 0; break; } From patchwork Fri Jun 5 16:25:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 11590003 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id F3FAD618 for ; Fri, 5 Jun 2020 16:27:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D8CEE2086A for ; Fri, 5 Jun 2020 16:27:06 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="nUIJaYZY" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728223AbgFEQ0k (ORCPT ); Fri, 5 Jun 2020 12:26:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40840 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728072AbgFEQ0e (ORCPT ); Fri, 5 Jun 2020 12:26:34 -0400 Received: from mail-pg1-x544.google.com (mail-pg1-x544.google.com [IPv6:2607:f8b0:4864:20::544]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 66C06C08C5C5; Fri, 5 Jun 2020 09:26:34 -0700 (PDT) Received: by mail-pg1-x544.google.com with SMTP id r10so5335895pgv.8; Fri, 05 Jun 2020 09:26:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=fueseL5wyjqHmp/EINkLjCle5ZJWz4SZll2cBBMMoIo=; b=nUIJaYZYkrn+NijNw3IyxCjOJU7xMm84eMHKy5wvWH2Pr2v5seb962AJ3NwN9SWUSk 3pbjkA7z7X5fda0JvTeq08VTwcdnLkJ9WOn67TT2dGvh4ZYiV1OhKuTOzAy5tm8yZqno hDabC4RfeKq3Wsj+qWUrFfl7k0pXzSJTK0ry+bECrK/nqHoOF4nM8vGlLbbIkfZrwYkO EIGLIamOTOIVerTnozi2L5k9f7308f2j2sJbHJ0kMnF4ZhnTAtJgFvL78dk3rWpvGWHD eWUuu0qWvDCYS08dZ/Up3OygMkLZITyIDr06L4NWlJrgurA/oYFtq8qMZXvktBnyK1oh fbbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=fueseL5wyjqHmp/EINkLjCle5ZJWz4SZll2cBBMMoIo=; b=KfDR5TW7I3g1M8PGV4ii75RS6jCq9rxZBA8Eq9djwoWGRnC0rqumNCaqBtRBNoTMii 9ncy98gE9jmP4BaN2p/1aV6SZO1YvVRoVmyRdzEscFzCqiwNulis+nEqNsdEm3NFmbJL wtdGt93ATMkuVfiLoRNWWhJI0pFpQA2CVkiKQJdcCIwMjdOMaQ7aU4Xaf2fm5gUrKETx OavjVsr22u9jf3yZJfIpOKzCOYZNLedudqetlL3SjqUpxdReA7SgvA4svhfoTPrrHXLJ hN/JicyPBlyKkjRenjjch19nd4pEQboBbmWWJTFIl7jpN4wVWdwfopAUu3/ZGpjJiquD EQLg== X-Gm-Message-State: AOAM531swIbXvToPjIRCJlYYQaIGool41TeFD2Z3ZR4RfQb7w8gWMiPO 7Ofs0wKboYMEDPBGvn4lj4Rhf+NS X-Google-Smtp-Source: ABdhPJzDKmT6IpB88utVE+CnCj6Mz/rXrSRYIZWebzvHb8KFaCquBtHj9sUHxWPIoy8dlgHvpiU+iQ== X-Received: by 2002:a62:5346:: with SMTP id h67mr9899045pfb.284.1591374393527; Fri, 05 Jun 2020 09:26:33 -0700 (PDT) Received: from localhost.localdomain ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id b29sm86205pff.176.2020.06.05.09.26.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Jun 2020 09:26:32 -0700 (PDT) From: Florian Fainelli X-Google-Original-From: Florian Fainelli To: linux-kernel@vger.kernel.org Cc: stable@vger.kernel.org, Jaedon Shin , Mauro Carvalho Chehab , Florian Fainelli , Mauro Carvalho Chehab , Michael Krufky , Alexander Viro , Shuah Khan , Colin Ian King , Katsuhiro Suzuki , Satendra Singh Thakur , linux-media@vger.kernel.org (open list:MEDIA INPUT INFRASTRUCTURE (V4L/DVB)), linux-fsdevel@vger.kernel.org (open list:FILESYSTEMS (VFS and infrastructure)) Subject: [PATCH stable 4.9 17/21] media: dvb_frontend: Add unlocked_ioctl in dvb_frontend.c Date: Fri, 5 Jun 2020 09:25:14 -0700 Message-Id: <20200605162518.28099-18-florian.fainelli@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200605162518.28099-1-florian.fainelli@broadcom.com> References: <20200605162518.28099-1-florian.fainelli@broadcom.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org From: Jaedon Shin commit a2282fd1fe2ebcda480426dbfaaa7c4e87e27399 upstream Adds unlocked ioctl function directly in dvb_frontend.c instead of using dvb_generic_ioctl(). Signed-off-by: Jaedon Shin Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Florian Fainelli --- drivers/media/dvb-core/dvb_frontend.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/drivers/media/dvb-core/dvb_frontend.c b/drivers/media/dvb-core/dvb_frontend.c index 6f9ee78a1870..dacc467e24af 100644 --- a/drivers/media/dvb-core/dvb_frontend.c +++ b/drivers/media/dvb-core/dvb_frontend.c @@ -1926,7 +1926,8 @@ static int dtv_property_process_set(struct dvb_frontend *fe, return r; } -static int dvb_frontend_ioctl(struct file *file, unsigned int cmd, void *parg) +static int dvb_frontend_do_ioctl(struct file *file, unsigned int cmd, + void *parg) { struct dvb_device *dvbdev = file->private_data; struct dvb_frontend *fe = dvbdev->priv; @@ -1969,6 +1970,17 @@ static int dvb_frontend_ioctl(struct file *file, unsigned int cmd, void *parg) return err; } +static long dvb_frontend_ioctl(struct file *file, unsigned int cmd, + unsigned long arg) +{ + struct dvb_device *dvbdev = file->private_data; + + if (!dvbdev) + return -ENODEV; + + return dvb_usercopy(file, cmd, arg, dvb_frontend_do_ioctl); +} + static int dtv_set_frontend(struct dvb_frontend *fe) { struct dvb_frontend_private *fepriv = fe->frontend_priv; @@ -2638,7 +2650,7 @@ static int dvb_frontend_release(struct inode *inode, struct file *file) static const struct file_operations dvb_frontend_fops = { .owner = THIS_MODULE, - .unlocked_ioctl = dvb_generic_ioctl, + .unlocked_ioctl = dvb_frontend_ioctl, .poll = dvb_frontend_poll, .open = dvb_frontend_open, .release = dvb_frontend_release, @@ -2706,7 +2718,6 @@ int dvb_register_frontend(struct dvb_adapter* dvb, #if defined(CONFIG_MEDIA_CONTROLLER_DVB) .name = fe->ops.info.name, #endif - .kernel_ioctl = dvb_frontend_ioctl }; dev_dbg(dvb->device, "%s:\n", __func__); From patchwork Fri Jun 5 16:25:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 11590005 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4BF0E618 for ; Fri, 5 Jun 2020 16:27:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 327F42077D for ; Fri, 5 Jun 2020 16:27:16 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ktvPYPKo" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728177AbgFEQ0j (ORCPT ); Fri, 5 Jun 2020 12:26:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40846 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728138AbgFEQ0h (ORCPT ); Fri, 5 Jun 2020 12:26:37 -0400 Received: from mail-pf1-x444.google.com (mail-pf1-x444.google.com [IPv6:2607:f8b0:4864:20::444]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8B8B7C08C5C3; Fri, 5 Jun 2020 09:26:36 -0700 (PDT) Received: by mail-pf1-x444.google.com with SMTP id z64so5144257pfb.1; Fri, 05 Jun 2020 09:26:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=/M5A1guudu8CJXvZtpOIJo9xlxZZgKSUXm5P8/pYAgw=; b=ktvPYPKo3lZjaa3dRu9oHGaxP9fF/hUHb3ButlgFIiamBO6VJkMuN++ASu1azTunoX 96CLz7jT8Kqe8Sp6J0aZWzodqkgpjHTq0Qh2joGS37Z0BmBlfgpk4PPqlLSzaBIASSJF M9xYNx2c2PHJU0nCp9bQ6mEoODz8S1doLSON2Y+oIqvdy8EbP03jr0C1+/3NS0mRAOym QIJSQyBWr60tvvnUtO57ihuycjxQR6L5WhS3cUl61MxpY3F0SForJK4LuELvxXUlltYm JRH21Kz7Gmy0Ke1EV/aysGW8ii+KFPbz5VetBeyVJSggT3zE6ucx52JAv3a2lB1Pp5nP a3Pg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=/M5A1guudu8CJXvZtpOIJo9xlxZZgKSUXm5P8/pYAgw=; b=VIbV6BmD8qwoeESR48HZpzxA4K6d3QL0MdoG20PHcZSkaJu0noQW7nZxikw4Vg6UXW QyYbGRizVj0Je4TTqymtq4qXxxBpwWUVqdZ6v+2GRaiTI2bojtAiNDCN9QAOaPKlNP4z 8eIkb1Ie68Wq+8d9YgnaVbWb5G3l7a165jCcouOCezkSCZ1nYArX2oGUuIlPUyagjHg6 WWn/P+8Y266ndfc+nzbf3MDFM267ZGFCx/COTw/DfRYCtbJ9LwTuKn+9KDGlVg+SOtTR oE4wfq4wJzQtH6y1wACz4G2j5S49V/YnyP6kdJ78xuEcHIPc62rTbIrW2T72ObUZyxBF tlpA== X-Gm-Message-State: AOAM5327wlTxTaIRjzs+JtGZTyoS07Ro0Vs9UoCAo0IN3nYv8mTD2aEv CpYjQ9C+tzRoKIIYZY2+qjd0WVy0 X-Google-Smtp-Source: ABdhPJxfnzKdAvBSAn2DGkGIAXsIn/7shQxn4bh6bG94ttICeG0q1VJlLp3bAV9SKpv105SrRyf2UQ== X-Received: by 2002:aa7:95bd:: with SMTP id a29mr10342882pfk.57.1591374395681; Fri, 05 Jun 2020 09:26:35 -0700 (PDT) Received: from localhost.localdomain ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id b29sm86205pff.176.2020.06.05.09.26.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Jun 2020 09:26:34 -0700 (PDT) From: Florian Fainelli X-Google-Original-From: Florian Fainelli To: linux-kernel@vger.kernel.org Cc: stable@vger.kernel.org, Jaedon Shin , Mauro Carvalho Chehab , Florian Fainelli , Mauro Carvalho Chehab , Michael Krufky , Alexander Viro , Shuah Khan , Colin Ian King , Katsuhiro Suzuki , Satendra Singh Thakur , linux-media@vger.kernel.org (open list:MEDIA INPUT INFRASTRUCTURE (V4L/DVB)), linux-fsdevel@vger.kernel.org (open list:FILESYSTEMS (VFS and infrastructure)) Subject: [PATCH stable 4.9 18/21] media: dvb_frontend: Add compat_ioctl callback Date: Fri, 5 Jun 2020 09:25:15 -0700 Message-Id: <20200605162518.28099-19-florian.fainelli@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200605162518.28099-1-florian.fainelli@broadcom.com> References: <20200605162518.28099-1-florian.fainelli@broadcom.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org From: Jaedon Shin commit c2dfd2276cec63a0c6f6ce18ed83800d96fde542 upstream Adds compat_ioctl for 32-bit user space applications on a 64-bit system. [m.chehab@osg.samsung.com: add missing include compat.h] Signed-off-by: Jaedon Shin Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Florian Fainelli --- drivers/media/dvb-core/dvb_frontend.c | 12 ++++++++++++ fs/compat_ioctl.c | 17 ----------------- 2 files changed, 12 insertions(+), 17 deletions(-) diff --git a/drivers/media/dvb-core/dvb_frontend.c b/drivers/media/dvb-core/dvb_frontend.c index dacc467e24af..c0a25cd6ccb8 100644 --- a/drivers/media/dvb-core/dvb_frontend.c +++ b/drivers/media/dvb-core/dvb_frontend.c @@ -41,6 +41,7 @@ #include #include #include +#include #include #include "dvb_frontend.h" @@ -1981,6 +1982,14 @@ static long dvb_frontend_ioctl(struct file *file, unsigned int cmd, return dvb_usercopy(file, cmd, arg, dvb_frontend_do_ioctl); } +#ifdef CONFIG_COMPAT +static long dvb_frontend_compat_ioctl(struct file *file, unsigned int cmd, + unsigned long arg) +{ + return dvb_frontend_ioctl(file, cmd, (unsigned long)compat_ptr(arg)); +} +#endif + static int dtv_set_frontend(struct dvb_frontend *fe) { struct dvb_frontend_private *fepriv = fe->frontend_priv; @@ -2651,6 +2660,9 @@ static int dvb_frontend_release(struct inode *inode, struct file *file) static const struct file_operations dvb_frontend_fops = { .owner = THIS_MODULE, .unlocked_ioctl = dvb_frontend_ioctl, +#ifdef CONFIG_COMPAT + .compat_ioctl = dvb_frontend_compat_ioctl, +#endif .poll = dvb_frontend_poll, .open = dvb_frontend_open, .release = dvb_frontend_release, diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c index 02ac9067a354..9fa3285425fe 100644 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c @@ -1340,23 +1340,6 @@ COMPATIBLE_IOCTL(DMX_GET_PES_PIDS) COMPATIBLE_IOCTL(DMX_GET_CAPS) COMPATIBLE_IOCTL(DMX_SET_SOURCE) COMPATIBLE_IOCTL(DMX_GET_STC) -COMPATIBLE_IOCTL(FE_GET_INFO) -COMPATIBLE_IOCTL(FE_DISEQC_RESET_OVERLOAD) -COMPATIBLE_IOCTL(FE_DISEQC_SEND_MASTER_CMD) -COMPATIBLE_IOCTL(FE_DISEQC_RECV_SLAVE_REPLY) -COMPATIBLE_IOCTL(FE_DISEQC_SEND_BURST) -COMPATIBLE_IOCTL(FE_SET_TONE) -COMPATIBLE_IOCTL(FE_SET_VOLTAGE) -COMPATIBLE_IOCTL(FE_ENABLE_HIGH_LNB_VOLTAGE) -COMPATIBLE_IOCTL(FE_READ_STATUS) -COMPATIBLE_IOCTL(FE_READ_BER) -COMPATIBLE_IOCTL(FE_READ_SIGNAL_STRENGTH) -COMPATIBLE_IOCTL(FE_READ_SNR) -COMPATIBLE_IOCTL(FE_READ_UNCORRECTED_BLOCKS) -COMPATIBLE_IOCTL(FE_SET_FRONTEND) -COMPATIBLE_IOCTL(FE_GET_FRONTEND) -COMPATIBLE_IOCTL(FE_GET_EVENT) -COMPATIBLE_IOCTL(FE_DISHNETWORK_SEND_LEGACY_CMD) COMPATIBLE_IOCTL(VIDEO_STOP) COMPATIBLE_IOCTL(VIDEO_PLAY) COMPATIBLE_IOCTL(VIDEO_FREEZE) From patchwork Fri Jun 5 16:25:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 11590009 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 65E8C1391 for ; Fri, 5 Jun 2020 16:27:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 476092077D for ; Fri, 5 Jun 2020 16:27:20 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="VzDo2HDe" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728419AbgFEQ1P (ORCPT ); Fri, 5 Jun 2020 12:27:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40854 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728151AbgFEQ0k (ORCPT ); Fri, 5 Jun 2020 12:26:40 -0400 Received: from mail-pl1-x643.google.com (mail-pl1-x643.google.com [IPv6:2607:f8b0:4864:20::643]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 18E1CC08C5C2; Fri, 5 Jun 2020 09:26:39 -0700 (PDT) Received: by mail-pl1-x643.google.com with SMTP id n2so3809348pld.13; Fri, 05 Jun 2020 09:26:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=iDQgGfOy6ldHVs5uNpQriET3jeGe/mkeG7jR7Di4Pt0=; b=VzDo2HDeTObGijOzuxOPMg2bjqmZZHU21My3x8RUKhb8LRKOqa4cYT5z4vQMmOqVgs CQWtDQVlQMuzSW8M7UmwIRlvWlaGtNEOrZ5dFqs8zJoOWJlwE8D1t1+ZgvfYgAGL1TZ5 FzUpfPXioDq7Dp14jk8z/2VXfla6v0gidfuo2Y6PfQb16qqhaRqiQQIH0Zoa5lZSNs1P 9teXl722s/9Szt31jLk2yyk6AYLcCtr4MZF7gSejeQxacqpgIdMrswNfGx9Mzpis80Be IEb+5A+vKCIB6I9i6D6mrEh/2+011oiYHN8gcczWWjUXznf3Hw5ip3bPQkff2rJWjCpP 3jfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=iDQgGfOy6ldHVs5uNpQriET3jeGe/mkeG7jR7Di4Pt0=; b=ju/VmNbR+V9LQ4tIqCyT1fWpem22PFnpZU5x1GgxTFCnSZ4OZChsFATJ+ETCYVwPg2 Lg/b+477I2LNxo8yLNXhm0OvYv67OUhKUvm3fVf3EdlO1Y7l0KHCQVSVmvtPRd+1mkBd EYItghHuu+638fAr9mJAO8afGnWP/DJcONEmeE3Ae21NJRPj9M3ucyFuh2I1Q/e3TzHJ kKMEmE5EosY9G6vD0hbOurprlJUl/MMiix1fk/+Cd4t3XEjswaFQXFSxt0dBWaoD+rh6 7IPvfLNwPibqFfq3t0kgtQc9KdpQ/iCL/qRx7mcfzfiztziWNWhimeU+jH9GKV8rR6gm bjZA== X-Gm-Message-State: AOAM533L/a5k6Hk7d3qAUvI6S4YJmblCtzX4iixNyTDxAK5UeNZ8mzAK JKIJ0LYM3XafTaoqOQOprnrMmTIG X-Google-Smtp-Source: ABdhPJx8cO6H0Ki2knLseZ0hHVik4GtM+/9YXQPB1y8TmFAEVVYQUtjegXU7n+eUPZKDKs3c/NTsRw== X-Received: by 2002:a17:90a:fe83:: with SMTP id co3mr3873149pjb.204.1591374398219; Fri, 05 Jun 2020 09:26:38 -0700 (PDT) Received: from localhost.localdomain ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id b29sm86205pff.176.2020.06.05.09.26.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Jun 2020 09:26:37 -0700 (PDT) From: Florian Fainelli X-Google-Original-From: Florian Fainelli To: linux-kernel@vger.kernel.org Cc: stable@vger.kernel.org, Jaedon Shin , Mauro Carvalho Chehab , Florian Fainelli , Mauro Carvalho Chehab , Michael Krufky , Alexander Viro , Shuah Khan , Colin Ian King , Katsuhiro Suzuki , Satendra Singh Thakur , linux-media@vger.kernel.org (open list:MEDIA INPUT INFRASTRUCTURE (V4L/DVB)), linux-fsdevel@vger.kernel.org (open list:FILESYSTEMS (VFS and infrastructure)) Subject: [PATCH stable 4.9 19/21] media: dvb_frontend: Add commands implementation for compat ioct Date: Fri, 5 Jun 2020 09:25:16 -0700 Message-Id: <20200605162518.28099-20-florian.fainelli@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200605162518.28099-1-florian.fainelli@broadcom.com> References: <20200605162518.28099-1-florian.fainelli@broadcom.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org From: Jaedon Shin commit 18192a77f0810933ab71a46c1b260d230d7352ee upstream The dtv_properties structure and the dtv_property structure are different sizes in 32-bit and 64-bit system. This patch provides FE_SET_PROPERTY and FE_GET_PROPERTY ioctl commands implementation for 32-bit user space applications. Signed-off-by: Jaedon Shin Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Florian Fainelli --- drivers/media/dvb-core/dvb_frontend.c | 131 ++++++++++++++++++++++++++ 1 file changed, 131 insertions(+) diff --git a/drivers/media/dvb-core/dvb_frontend.c b/drivers/media/dvb-core/dvb_frontend.c index c0a25cd6ccb8..34f55a2ba071 100644 --- a/drivers/media/dvb-core/dvb_frontend.c +++ b/drivers/media/dvb-core/dvb_frontend.c @@ -1983,9 +1983,140 @@ static long dvb_frontend_ioctl(struct file *file, unsigned int cmd, } #ifdef CONFIG_COMPAT +struct compat_dtv_property { + __u32 cmd; + __u32 reserved[3]; + union { + __u32 data; + struct dtv_fe_stats st; + struct { + __u8 data[32]; + __u32 len; + __u32 reserved1[3]; + compat_uptr_t reserved2; + } buffer; + } u; + int result; +} __attribute__ ((packed)); + +struct compat_dtv_properties { + __u32 num; + compat_uptr_t props; +}; + +#define COMPAT_FE_SET_PROPERTY _IOW('o', 82, struct compat_dtv_properties) +#define COMPAT_FE_GET_PROPERTY _IOR('o', 83, struct compat_dtv_properties) + +static int dvb_frontend_handle_compat_ioctl(struct file *file, unsigned int cmd, + unsigned long arg) +{ + struct dvb_device *dvbdev = file->private_data; + struct dvb_frontend *fe = dvbdev->priv; + struct dvb_frontend_private *fepriv = fe->frontend_priv; + int i, err = 0; + + if (cmd == COMPAT_FE_SET_PROPERTY) { + struct compat_dtv_properties prop, *tvps = NULL; + struct compat_dtv_property *tvp = NULL; + + if (copy_from_user(&prop, compat_ptr(arg), sizeof(prop))) + return -EFAULT; + + tvps = ∝ + + /* + * Put an arbitrary limit on the number of messages that can + * be sent at once + */ + if (!tvps->num || (tvps->num > DTV_IOCTL_MAX_MSGS)) + return -EINVAL; + + tvp = memdup_user(compat_ptr(tvps->props), tvps->num * sizeof(*tvp)); + if (IS_ERR(tvp)) + return PTR_ERR(tvp); + + for (i = 0; i < tvps->num; i++) { + err = dtv_property_process_set(fe, file, + (tvp + i)->cmd, + (tvp + i)->u.data); + if (err < 0) { + kfree(tvp); + return err; + } + } + kfree(tvp); + } else if (cmd == COMPAT_FE_GET_PROPERTY) { + struct compat_dtv_properties prop, *tvps = NULL; + struct compat_dtv_property *tvp = NULL; + struct dtv_frontend_properties getp = fe->dtv_property_cache; + + if (copy_from_user(&prop, compat_ptr(arg), sizeof(prop))) + return -EFAULT; + + tvps = ∝ + + /* + * Put an arbitrary limit on the number of messages that can + * be sent at once + */ + if (!tvps->num || (tvps->num > DTV_IOCTL_MAX_MSGS)) + return -EINVAL; + + tvp = memdup_user(compat_ptr(tvps->props), tvps->num * sizeof(*tvp)); + if (IS_ERR(tvp)) + return PTR_ERR(tvp); + + /* + * Let's use our own copy of property cache, in order to + * avoid mangling with DTV zigzag logic, as drivers might + * return crap, if they don't check if the data is available + * before updating the properties cache. + */ + if (fepriv->state != FESTATE_IDLE) { + err = dtv_get_frontend(fe, &getp, NULL); + if (err < 0) { + kfree(tvp); + return err; + } + } + for (i = 0; i < tvps->num; i++) { + err = dtv_property_process_get( + fe, &getp, (struct dtv_property *)tvp + i, file); + if (err < 0) { + kfree(tvp); + return err; + } + } + + if (copy_to_user((void __user *)compat_ptr(tvps->props), tvp, + tvps->num * sizeof(struct compat_dtv_property))) { + kfree(tvp); + return -EFAULT; + } + kfree(tvp); + } + + return err; +} + static long dvb_frontend_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg) { + struct dvb_device *dvbdev = file->private_data; + struct dvb_frontend *fe = dvbdev->priv; + struct dvb_frontend_private *fepriv = fe->frontend_priv; + int err; + + if (cmd == COMPAT_FE_SET_PROPERTY || cmd == COMPAT_FE_GET_PROPERTY) { + if (down_interruptible(&fepriv->sem)) + return -ERESTARTSYS; + + err = dvb_frontend_handle_compat_ioctl(file, cmd, arg); + + up(&fepriv->sem); + return err; + } + return dvb_frontend_ioctl(file, cmd, (unsigned long)compat_ptr(arg)); } #endif From patchwork Fri Jun 5 16:25:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 11589993 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AB8251391 for ; Fri, 5 Jun 2020 16:26:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 93FA92074B for ; Fri, 5 Jun 2020 16:26:46 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Q1bTgBJ8" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728284AbgFEQ0n (ORCPT ); Fri, 5 Jun 2020 12:26:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40860 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728244AbgFEQ0l (ORCPT ); Fri, 5 Jun 2020 12:26:41 -0400 Received: from mail-pj1-x1041.google.com (mail-pj1-x1041.google.com [IPv6:2607:f8b0:4864:20::1041]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 20648C08C5C2; Fri, 5 Jun 2020 09:26:41 -0700 (PDT) Received: by mail-pj1-x1041.google.com with SMTP id ne5so323358pjb.5; Fri, 05 Jun 2020 09:26:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=jV4daFGWsjhFnvffgzn/EdlePMcCRTFOIwlzfJCB7vg=; b=Q1bTgBJ8HMzy/86+TG56pOicptFiM5AtNDIh0w9tYHpnfvbs7cIaCjosUGRfiO+jpA IoAN0M+oDA1aRUo5+iNjk6/yR8QHpv8s1tqMtoc1LqgUOmB6HLLn/oB7SoD88wUvHbIM ooVEc16/+UmDtik4ehrqrjGy3822X2i7e1AE3eQZ8uV4qOQG7t1rNQMJJV29jTCH/zTL vNTS7kWubY0CWdV5jTt8w801IOuCN6a8D8gLmlZ9oluErqwc1YpWeNQLTLstTLMf1kLy XUKwL2XQ1wMgR2giDakXUC2aA5b46r8Z7VJTQbCuhPMU75Uz14/ccCWgxKGskuErRGfg uNZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=jV4daFGWsjhFnvffgzn/EdlePMcCRTFOIwlzfJCB7vg=; b=DhCppuI+2a0b/gUW7XKXgIANybB2mICU6v6gleA7NY6jN9vxt47Sz7wQzvwPpaJDjl C4HyrE8qcAW1skralf8IiXGYcC+TKl5Fe6OCor8lc+Rubu10qj+JqpGRQp4MGfCzHdrc rtpjZHpUUL2WQcmsRQDpP5FjoWk8FN/gWgkgjkDHAZ0t16xiEcuulA1BsSmlTHbJImbs Im3ujcFI2nVRxC/yUGAcOSqwoD9HMkbT3gk0NQGMr71/0D4ZaCtmiE+K5bi6MfeiQA65 bmZIfisLMvuvrd2jIaPXS3PV94i54lR7A/IF7Ger+OPqvZsBj6suavb48gmlacwwdPPY qPXg== X-Gm-Message-State: AOAM530Mn6ypGBD4YrCgFZcVMVED+o2HeAcq/wGp6H2WutSyKthvMzv5 g33d9USBIuTfWLTPkDQIDB0a7bOh X-Google-Smtp-Source: ABdhPJyfwzO5S6XEAP00SbLLtWAexdM+5vcogfl2B+Tnm13qnaE41Xn9B+pv7ADE7jfI2wyBG8GV0w== X-Received: by 2002:a17:90a:3321:: with SMTP id m30mr3985903pjb.20.1591374400291; Fri, 05 Jun 2020 09:26:40 -0700 (PDT) Received: from localhost.localdomain ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id b29sm86205pff.176.2020.06.05.09.26.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Jun 2020 09:26:39 -0700 (PDT) From: Florian Fainelli X-Google-Original-From: Florian Fainelli To: linux-kernel@vger.kernel.org Cc: stable@vger.kernel.org, Katsuhiro Suzuki , Mauro Carvalho Chehab , Florian Fainelli , Mauro Carvalho Chehab , Michael Krufky , Alexander Viro , Shuah Khan , Jaedon Shin , Colin Ian King , Satendra Singh Thakur , linux-media@vger.kernel.org (open list:MEDIA INPUT INFRASTRUCTURE (V4L/DVB)), linux-fsdevel@vger.kernel.org (open list:FILESYSTEMS (VFS and infrastructure)) Subject: [PATCH stable 4.9 20/21] media: dvb_frontend: fix wrong cast in compat_ioctl Date: Fri, 5 Jun 2020 09:25:17 -0700 Message-Id: <20200605162518.28099-21-florian.fainelli@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200605162518.28099-1-florian.fainelli@broadcom.com> References: <20200605162518.28099-1-florian.fainelli@broadcom.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org From: Katsuhiro Suzuki commit 5c6c9c4830b76d851d38829611b3c3e4be0f5cdf upstream FE_GET_PROPERTY has always failed as following situations: - Use compatible ioctl - The array of 'struct dtv_property' has 2 or more items This patch fixes wrong cast to a pointer 'struct dtv_property' from a pointer of 2nd or after item of 'struct compat_dtv_property' array. Signed-off-by: Katsuhiro Suzuki Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Florian Fainelli --- drivers/media/dvb-core/dvb_frontend.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/dvb-core/dvb_frontend.c b/drivers/media/dvb-core/dvb_frontend.c index 34f55a2ba071..740dedf03361 100644 --- a/drivers/media/dvb-core/dvb_frontend.c +++ b/drivers/media/dvb-core/dvb_frontend.c @@ -2081,7 +2081,7 @@ static int dvb_frontend_handle_compat_ioctl(struct file *file, unsigned int cmd, } for (i = 0; i < tvps->num; i++) { err = dtv_property_process_get( - fe, &getp, (struct dtv_property *)tvp + i, file); + fe, &getp, (struct dtv_property *)(tvp + i), file); if (err < 0) { kfree(tvp); return err; From patchwork Fri Jun 5 16:25:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 11589995 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E9A58618 for ; Fri, 5 Jun 2020 16:27:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CD2562086A for ; Fri, 5 Jun 2020 16:27:00 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="LC9xGG5M" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728367AbgFEQ0z (ORCPT ); Fri, 5 Jun 2020 12:26:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40870 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728300AbgFEQ0o (ORCPT ); Fri, 5 Jun 2020 12:26:44 -0400 Received: from mail-pl1-x644.google.com (mail-pl1-x644.google.com [IPv6:2607:f8b0:4864:20::644]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7D001C08C5C2; Fri, 5 Jun 2020 09:26:43 -0700 (PDT) Received: by mail-pl1-x644.google.com with SMTP id v24so3825970plo.6; Fri, 05 Jun 2020 09:26:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=s6oLxuZtz92MCMs+Rc0jAsvvKy4fsrw+h3fzX94hKHI=; b=LC9xGG5Mpl7l9RocA+JmkF3GXVhNsllocgKi08w3I/rV5Pvheph3idCf9rJfkJF8gy c7m05ERn1FldKvEFXHMxvLJl8BT/nIyf+QIMw6iNMcdl55IbZR8msVD2gZOxoIIiTl5c +TNOJa8uLfw6SVEhHf23IWYJQZ7PNisgeQFKyQ6AHCEdkqddGzlViSu1PJeadPTxc1SB k7bUzlJLicjyQlwYVVI88Sz+NXj2YxLFUY+5fxEyCjOjRUJJ5k44nhdLmifKv51p0FZH pROVUBhPNRg5GClRhqXYL0L29RXYn761O+su/eqXL40VciugEtlWAz+quQv7sSI10Rtq ItMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=s6oLxuZtz92MCMs+Rc0jAsvvKy4fsrw+h3fzX94hKHI=; b=PQ9f9Ade/gUzyZy5S9Vo6KGNqSRI3aLOEzYtuUDr54I0cG8JkE9QgZl57A01/tDrYn +HLGOlEpaGzJ2uS/jh474dYOf2ipJpqRGjB8ogX+Kt7tA6QZfI1H8me3c+ekbqQHFENL CYWfAct77rlVM4t3QnpTJ/TpyHdo/Q502xotZ5k+1jrRvF2UeuFcr+KWPqoQOvR2g9zn o/vUZrPFTxEdl11j8l3GgY2FtIYcBbKWJRDdHEd5+BR3AovQupx1yH0O1WRvZyMEFOlX WtjJLocZ2yyz5us39xEyAzYAmrTrC1FYz4XNIO1wCNOOgL5KpgyM9GB/2X+CDy6/OZXc KKSA== X-Gm-Message-State: AOAM530F358/FxuRXdvSKQmnWEB5nkTF5QMGR6f4CjkV3YwdvnqRQ+nN czKPO8nTnLe5sHrYQI1Pb7yoFrz+ X-Google-Smtp-Source: ABdhPJzGvAyLDr9UoI4bW8o5yZzXk+PoTpDmgdFNhxX7kuEbHzhX2mG+MBfWxqp5UKeyXBsErABbZw== X-Received: by 2002:a17:90a:d487:: with SMTP id s7mr3858502pju.37.1591374402616; Fri, 05 Jun 2020 09:26:42 -0700 (PDT) Received: from localhost.localdomain ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id b29sm86205pff.176.2020.06.05.09.26.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Jun 2020 09:26:41 -0700 (PDT) From: Florian Fainelli X-Google-Original-From: Florian Fainelli To: linux-kernel@vger.kernel.org Cc: stable@vger.kernel.org, Mauro Carvalho Chehab , Florian Fainelli , Mauro Carvalho Chehab , Michael Krufky , Alexander Viro , Shuah Khan , Jaedon Shin , Colin Ian King , Katsuhiro Suzuki , Satendra Singh Thakur , linux-media@vger.kernel.org (open list:MEDIA INPUT INFRASTRUCTURE (V4L/DVB)), linux-fsdevel@vger.kernel.org (open list:FILESYSTEMS (VFS and infrastructure)) Subject: [PATCH stable 4.9 21/21] media: dvb_frontend: fix return error code Date: Fri, 5 Jun 2020 09:25:18 -0700 Message-Id: <20200605162518.28099-22-florian.fainelli@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200605162518.28099-1-florian.fainelli@broadcom.com> References: <20200605162518.28099-1-florian.fainelli@broadcom.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org From: Mauro Carvalho Chehab commit 330dada5957e3ca0c8811b14c45e3ac42c694651 upstream The correct error code when a function is not defined is -ENOTSUPP. It was typoed wrong as -EOPNOTSUPP, with, unfortunately, exists, but it is not used by the DVB core. Thanks-to: Geert Uytterhoeven Thanks-to: Arnd Bergmann To make me revisit this code. Fixes: a9cb97c3e628 ("media: dvb_frontend: be sure to init dvb_frontend_handle_ioctl() return code") Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Florian Fainelli --- drivers/media/dvb-core/dvb_frontend.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/dvb-core/dvb_frontend.c b/drivers/media/dvb-core/dvb_frontend.c index 740dedf03361..cd45b3894661 100644 --- a/drivers/media/dvb-core/dvb_frontend.c +++ b/drivers/media/dvb-core/dvb_frontend.c @@ -2265,7 +2265,7 @@ static int dvb_frontend_handle_ioctl(struct file *file, struct dvb_frontend *fe = dvbdev->priv; struct dvb_frontend_private *fepriv = fe->frontend_priv; struct dtv_frontend_properties *c = &fe->dtv_property_cache; - int i, err = -EOPNOTSUPP; + int i, err = -ENOTSUPP; dev_dbg(fe->dvb->device, "%s:\n", __func__);