From patchwork Sat Feb 24 18:55:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Scheller X-Patchwork-Id: 10240457 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 F421E602A0 for ; Sat, 24 Feb 2018 18:55:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E790029BFA for ; Sat, 24 Feb 2018 18:55:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DC53929C00; Sat, 24 Feb 2018 18:55:46 +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 88E2929BFA for ; Sat, 24 Feb 2018 18:55:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751475AbeBXSzp (ORCPT ); Sat, 24 Feb 2018 13:55:45 -0500 Received: from mail-wm0-f66.google.com ([74.125.82.66]:55869 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751399AbeBXSzl (ORCPT ); Sat, 24 Feb 2018 13:55:41 -0500 Received: by mail-wm0-f66.google.com with SMTP id q83so10484361wme.5 for ; Sat, 24 Feb 2018 10:55:40 -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=Y2YqftwE4n3SM4pBPXYYclxTBeWa2/iOkU4bhcIeFrdMNyOevGJdapO7iesC4sdGxD L4J8aKUJjHSi3HS798zUkggIpV5nfSofX45bTWesHBv4eM7x1OlageRcM/wqTX+6y0ZM JimPMj/FJGYkm4MupeR0Ah5GJQzCzMSGmuHv0iNvvNCC/XWnc9sz+/q1eTzNiyH5zqHE +UfHL/Mia1wLrZl0Uy+wuBTll1e4PFdiQCI65DNVOP6/HJhB4wu9ZPqKjhDEwzR9IC4p cQkfT7rtlZDbz5PX7aeEVMVxlNDZRNsePA10KWv+E3WDw3AQuMQnbZFluiKdp1xGcyjn KeTg== 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=YdbvhDhT4ubpHtj+ForWEa+jew1rXdW186NxFLk7Gzbfs6Z2aLD1HyS3kty3rPDJy0 ZfDYDD6W2Tk/xCP5rMEYtZayHt36SVoWn2Nq0KFKmkAlpiR0BRMj9aK6RKWN/oPyPGm5 8FyXeVfdpECQgGAITow0vxngXdPwJ/jjL2Mt+QjuteuhNXeK0XTcts6R3ZmAsHW91LzC pUBmVgGhNsvPxH0tRe0FOZQSIAHUOH/HkFJz4jzKtDGyDRQtp0Mm9aIOHkFqjOXAzd1P hsadVcarEXD4wPoUwHi1hud6+mkPMNuaBl9I8kKfb4cGFO2RB+f1HKB50720wmKfoRtr oTuA== X-Gm-Message-State: APf1xPA7009klPVbKJPilWKuQvnk1XRxrZS4SRKneTRHs/BKXPucDsEo cOn1z6JuZo0ZT15KGONteVG75g== X-Google-Smtp-Source: AG47ELuX5rY2oZAs/AvjIcnvZmNGnWeq62ceXZVSpAT6kxC6+3NntNb/sKKWqzGNmtn89/KXXSTdag== X-Received: by 10.28.111.198 with SMTP id c67mr4571494wmi.83.1519498539777; Sat, 24 Feb 2018 10:55:39 -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 3sm526270wry.29.2018.02.24.10.55.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 24 Feb 2018 10:55:39 -0800 (PST) From: Daniel Scheller To: linux-media@vger.kernel.org, mchehab@kernel.org, mchehab@s-opensource.com Subject: [PATCH 03/12] [media] ngene: use defines to identify the demod_type Date: Sat, 24 Feb 2018 19:55:25 +0100 Message-Id: <20180224185534.13792-4-d.scheller.oss@gmail.com> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180224185534.13792-1-d.scheller.oss@gmail.com> References: <20180224185534.13792-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,