From patchwork Fri Oct 5 10:29:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 10627867 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id F0D6D184E for ; Fri, 5 Oct 2018 10:29:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E1DD129084 for ; Fri, 5 Oct 2018 10:29:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D65FD2908E; Fri, 5 Oct 2018 10:29:44 +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.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,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 719FA2908C for ; Fri, 5 Oct 2018 10:29:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728010AbeJER1x (ORCPT ); Fri, 5 Oct 2018 13:27:53 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:43968 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727535AbeJER1x (ORCPT ); Fri, 5 Oct 2018 13:27:53 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Sender:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=XvMowuOUtRuYoGVHncDT7iLuIcL6kGKEptk7rnrKS3A=; b=UQ9zvdlmKFyBXbk9UM8v/Bszs x74i+F41o/4oEgAHmaNyszF6XmmACPElasdMWFfORIy7fb03JTYOXAdvckG122ljtsq0oCtylvq5M i8AQIbNXo+eS+Wz5O215v3kXmCrfYWzss2qgPKHbhEwYCQ039oRMgIthLK94hMVvzLn3kDCHBi4Ie hH1ie51JcRn1j98k1zc1eyvpUgmeNOt7A6jH+Y3cltfbjyMbmcvvT6SJ1EzxiJqujCYdigpHXRu3D KIRaSC9LlpFWK5oBTDL+CqFhuLcr19icExMbpYxfQYn8ibQdeJkX6V7GQjpPTXPaF0IOeQON0emjv BYQrjvQpg==; Received: from 177.206.133.246.dynamic.adsl.gvt.net.br ([177.206.133.246] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1g8NMc-00058S-B5; Fri, 05 Oct 2018 10:29:42 +0000 Received: from mchehab by bombadil.infradead.org with local (Exim 4.91) (envelope-from ) id 1g8NMa-0008qp-4S; Fri, 05 Oct 2018 06:29:40 -0400 From: Mauro Carvalho Chehab Cc: Mauro Carvalho Chehab , Linux Media Mailing List , Mauro Carvalho Chehab , Sakari Ailus , =?utf-8?q?Niklas_S=C3=B6derlun?= =?utf-8?q?d?= , Hans Verkuil , Sebastian Reichel , Steve Longerbeam Subject: [PATCH v2 3/3] media: v4l2-fwnode: simplify v4l2_fwnode_reference_parse_int_props() call Date: Fri, 5 Oct 2018 06:29:38 -0400 Message-Id: <28df1a3ba4ddb759e0b762c0f2734d523fdadc3a.1538735151.git.mchehab+samsung@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: In-Reply-To: References: To: unlisted-recipients:; (no To-header on input) Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The v4l2_fwnode_reference_parse_int_props() has a big name, causing it to cause coding style warnings. Also, it depends on a const struct embedded indide a function. Rearrange the logic in order to move the struct declaration out of such function and use it inside this function. That cleans up some coding style issues. Acked-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab --- drivers/media/v4l2-core/v4l2-fwnode.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/drivers/media/v4l2-core/v4l2-fwnode.c b/drivers/media/v4l2-core/v4l2-fwnode.c index a7c2487154a4..218f0da0ce76 100644 --- a/drivers/media/v4l2-core/v4l2-fwnode.c +++ b/drivers/media/v4l2-core/v4l2-fwnode.c @@ -1006,6 +1006,12 @@ v4l2_fwnode_reference_get_int_prop(struct fwnode_handle *fwnode, return fwnode; } +struct v4l2_fwnode_int_props { + const char *name; + const char * const *props; + unsigned int nprops; +}; + /* * v4l2_fwnode_reference_parse_int_props - parse references for async * sub-devices @@ -1032,13 +1038,14 @@ v4l2_fwnode_reference_get_int_prop(struct fwnode_handle *fwnode, static int v4l2_fwnode_reference_parse_int_props(struct device *dev, struct v4l2_async_notifier *notifier, - const char *prop, - const char * const *props, - unsigned int nprops) + const struct v4l2_fwnode_int_props *p) { struct fwnode_handle *fwnode; unsigned int index; int ret; + const char *prop = p->name; + const char * const *props = p->props; + unsigned int nprops = p->nprops; index = 0; do { @@ -1093,11 +1100,7 @@ int v4l2_async_notifier_parse_fwnode_sensor_common(struct device *dev, struct v4l2_async_notifier *notifier) { static const char * const led_props[] = { "led" }; - static const struct { - const char *name; - const char * const *props; - unsigned int nprops; - } props[] = { + static const struct v4l2_fwnode_int_props props[] = { { "flash-leds", led_props, ARRAY_SIZE(led_props) }, { "lens-focus", NULL, 0 }, }; @@ -1109,9 +1112,7 @@ int v4l2_async_notifier_parse_fwnode_sensor_common(struct device *dev, if (props[i].props && is_acpi_node(dev_fwnode(dev))) ret = v4l2_fwnode_reference_parse_int_props(dev, notifier, - props[i].name, - props[i].props, - props[i].nprops); + &props[i]); else ret = v4l2_fwnode_reference_parse(dev, notifier, props[i].name);