From patchwork Sat Apr 30 03:17:09 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ismael Luceno X-Patchwork-Id: 8986451 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 5A836BF440 for ; Sat, 30 Apr 2016 03:23:54 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9507020212 for ; Sat, 30 Apr 2016 03:23:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A1829201ED for ; Sat, 30 Apr 2016 03:23:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752334AbcD3DXr (ORCPT ); Fri, 29 Apr 2016 23:23:47 -0400 Received: from iodev.co.uk ([82.211.30.53]:33960 "EHLO iodev.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752329AbcD3DXq (ORCPT ); Fri, 29 Apr 2016 23:23:46 -0400 Received: from localhost (unknown [186.153.93.20]) by iodev.co.uk (Postfix) with ESMTPSA id 463A31F0D0; Fri, 29 Apr 2016 23:16:11 -0400 (EDT) From: Ismael Luceno To: linux-media@vger.kernel.org Cc: Hans Verkuil , Ismael Luceno Subject: [PATCH 2/2] solo6x10: Simplify solo_enum_ext_input Date: Sat, 30 Apr 2016 00:17:09 -0300 Message-Id: <1461986229-11949-2-git-send-email-ismael@iodev.co.uk> X-Mailer: git-send-email 2.8.0 In-Reply-To: <1461986229-11949-1-git-send-email-ismael@iodev.co.uk> References: <1461986229-11949-1-git-send-email-ismael@iodev.co.uk> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-7.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Additionally, now it specifies which channels it's showing. Signed-off-by: Ismael Luceno --- drivers/media/pci/solo6x10/solo6x10-v4l2.c | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/drivers/media/pci/solo6x10/solo6x10-v4l2.c b/drivers/media/pci/solo6x10/solo6x10-v4l2.c index 721ff53..935c1b6 100644 --- a/drivers/media/pci/solo6x10/solo6x10-v4l2.c +++ b/drivers/media/pci/solo6x10/solo6x10-v4l2.c @@ -386,26 +386,17 @@ static int solo_querycap(struct file *file, void *priv, static int solo_enum_ext_input(struct solo_dev *solo_dev, struct v4l2_input *input) { - static const char * const dispnames_1[] = { "4UP" }; - static const char * const dispnames_2[] = { "4UP-1", "4UP-2" }; - static const char * const dispnames_5[] = { - "4UP-1", "4UP-2", "4UP-3", "4UP-4", "16UP" - }; - const char * const *dispnames; - - if (input->index >= (solo_dev->nr_chans + solo_dev->nr_ext)) - return -EINVAL; - - if (solo_dev->nr_ext == 5) - dispnames = dispnames_5; - else if (solo_dev->nr_ext == 2) - dispnames = dispnames_2; - else - dispnames = dispnames_1; + int ext = input->index - solo_dev->nr_chans; + unsigned int nup, first; - snprintf(input->name, sizeof(input->name), "Multi %s", - dispnames[input->index - solo_dev->nr_chans]); + if (ext >= solo_dev->nr_ext) + return -EINVAL; + nup = (ext == 4) ? 16 : 4; + first = (ext & 3) << 2; + snprintf(input->name, sizeof(input->name), + "Multi %d-up (cameras %d-%d)", + nup, first + 1, first + nup); return 0; }