From patchwork Sun Feb 25 12:31:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Scheller X-Patchwork-Id: 10240843 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2CFC7603B4 for ; Sun, 25 Feb 2018 12:31:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2019C29CE4 for ; Sun, 25 Feb 2018 12:31:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1259D29CED; Sun, 25 Feb 2018 12:31:53 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B1BEF29CE4 for ; Sun, 25 Feb 2018 12:31:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751712AbeBYMbv (ORCPT ); Sun, 25 Feb 2018 07:31:51 -0500 Received: from mail-wm0-f65.google.com ([74.125.82.65]:51701 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751728AbeBYMbr (ORCPT ); Sun, 25 Feb 2018 07:31:47 -0500 Received: by mail-wm0-f65.google.com with SMTP id h21so12543535wmd.1 for ; Sun, 25 Feb 2018 04:31:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references; bh=9MHZTH0hcdg794inl/aTEhuC/nzz2kgBKQ7X/HpthKU=; b=tIHosAyGX41FqYunfv9rNhqORusxJB6wOXl064L+L/dNcJmTpz8dc2ll+B6r7WmHiZ tJhzOknoQGkE+Omar9IJ4ZpJteTKPw2zL2vR/LXWlgoj4rCcPKlSqNjQBpHHFSlGDsj6 T+to1U5h9kOScMQcjkX/VXdt7GFPlGVBSLlTD4OqUYAdlmzpdc3im0YccfMlhREXMyUS QNsteOWeM/ZwNvRH1nUJoI68/89P8xflY6Ei43VjtkVjvQKMOatvpaIV+AXusdUqzzDb xxlcNfxYQm8tak55ZmE6C8wzJJWGRh2507gpIFjL20FE+Wj2E1VBJ+rvQR5pH6ArAVvq /FnQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=9MHZTH0hcdg794inl/aTEhuC/nzz2kgBKQ7X/HpthKU=; b=EG0NSIaLdL0OSQ4OuNDj7ZyJUqr6SetTKp5RAWO6qFM56zjt4zacbNMOua8Cd2hacN FhwgOGXRLeR99IpKnjuhreJP2dOFz4s/8MOZLx9vMqWQ/DINEFpA/XN6eBilIyYCb613 /5F9zdWO7bJkOi2GQAawVEt23v8un8+eEBT2EEnyYqAdIn1qkg0ec+J6DWTi2SG2lE9K C9xf9AQAeFYAjgQ9eSTz78W+o7G/dbAeMZKKHGnGYZKGXO0xfG2oxmBwuZlTutR0p9zy qVIA8Z72qvF27MFR6fCIS3+JQc1GbkDgeZx7W/cyBv3SVVuK92kRgkOF+Tqjs42eBTS9 09og== X-Gm-Message-State: APf1xPATZenPXQ7oUbZGiI/fZUM58NS/f/tsCnHAywzPtCUPBaMIvmb4 xz/Vyqkt9bejQrUUboiiia8m9w== X-Google-Smtp-Source: AG47ELsslLzBNLlz0ajN1xfVTuwjomxIAuvrK9ITRBlkKnyWrondNb8bf7v+Jk2iC6pngiDhYl93cg== X-Received: by 10.28.141.131 with SMTP id p125mr6031012wmd.0.1519561905985; Sun, 25 Feb 2018 04:31:45 -0800 (PST) Received: from dvbdev.wuest.de (ip-84-118-193-200.unity-media.net. [84.118.193.200]) by smtp.gmail.com with ESMTPSA id y34sm15304779wry.19.2018.02.25.04.31.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 25 Feb 2018 04:31:45 -0800 (PST) From: Daniel Scheller To: linux-media@vger.kernel.org, mchehab@kernel.org, mchehab@s-opensource.com Subject: [PATCH v2 03/12] [media] ngene: use defines to identify the demod_type Date: Sun, 25 Feb 2018 13:31:31 +0100 Message-Id: <20180225123140.19486-4-d.scheller.oss@gmail.com> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180225123140.19486-1-d.scheller.oss@gmail.com> References: <20180225123140.19486-1-d.scheller.oss@gmail.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Daniel Scheller Make it more clear which demod_type is used for which hardware by having defines for the possible demod_type values. With that, change the demod_type evaluation in tuner_attach_probe() to a switch-case instead of an if() for each possible value. Signed-off-by: Daniel Scheller --- drivers/media/pci/ngene/ngene-cards.c | 11 +++++++---- drivers/media/pci/ngene/ngene.h | 3 +++ 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/drivers/media/pci/ngene/ngene-cards.c b/drivers/media/pci/ngene/ngene-cards.c index 16666de8cbee..065b83ee569b 100644 --- a/drivers/media/pci/ngene/ngene-cards.c +++ b/drivers/media/pci/ngene/ngene-cards.c @@ -123,10 +123,13 @@ static int tuner_attach_tda18271(struct ngene_channel *chan) static int tuner_attach_probe(struct ngene_channel *chan) { - if (chan->demod_type == 0) + switch (chan->demod_type) { + case DEMOD_TYPE_STV090X: return tuner_attach_stv6110(chan); - if (chan->demod_type == 1) + case DEMOD_TYPE_DRXK: return tuner_attach_tda18271(chan); + } + return -EINVAL; } @@ -251,7 +254,7 @@ static int cineS2_probe(struct ngene_channel *chan) i2c = &chan->dev->channel[1].i2c_adapter; if (port_has_stv0900(i2c, chan->number)) { - chan->demod_type = 0; + chan->demod_type = DEMOD_TYPE_STV090X; fe_conf = chan->dev->card_info->fe_config[chan->number]; /* demod found, attach it */ rc = demod_attach_stv0900(chan); @@ -280,7 +283,7 @@ static int cineS2_probe(struct ngene_channel *chan) return -EIO; } } else if (port_has_drxk(i2c, chan->number^2)) { - chan->demod_type = 1; + chan->demod_type = DEMOD_TYPE_DRXK; demod_attach_drxk(chan, i2c); } else { dev_err(pdev, "No demod found on chan %d\n", chan->number); diff --git a/drivers/media/pci/ngene/ngene.h b/drivers/media/pci/ngene/ngene.h index caf8602c7459..9724701a3274 100644 --- a/drivers/media/pci/ngene/ngene.h +++ b/drivers/media/pci/ngene/ngene.h @@ -51,6 +51,9 @@ #define VIDEO_CAP_MPEG4 512 #endif +#define DEMOD_TYPE_STV090X 0 +#define DEMOD_TYPE_DRXK 1 + enum STREAM { STREAM_VIDEOIN1 = 0, /* ITU656 or TS Input */ STREAM_VIDEOIN2,