From patchwork Thu Oct 4 22:13:48 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: 10626939 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 C5D2F174A for ; Thu, 4 Oct 2018 22:13:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B79B42951F for ; Thu, 4 Oct 2018 22:13:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id ABB8E29520; Thu, 4 Oct 2018 22:13:55 +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 3C18C29524 for ; Thu, 4 Oct 2018 22:13:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726078AbeJEFJU (ORCPT ); Fri, 5 Oct 2018 01:09:20 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:46278 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725996AbeJEFJU (ORCPT ); Fri, 5 Oct 2018 01:09:20 -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=CzWxqsH3bSVDen4loBrcI/QPk8NOT/d+winCMyH++Wc=; b=S/rBt7tR8JAqmruC4i8YPUBcR HR2bPI5upVULM0LDzdwquBjeJ3T3I3Na6HAj58apzCpmTNUTq/7laU9YiYKC1fMSZo1vsnxZfkKiL ff0iSn72q8gzvqFy3I2P2HWewQ5Y5WGDKkr9oczqbnRy/VqnrMFCqxxjtpJEZ1/e/4Efj15py3hMh 9vjPZT5mXdA29odBNLp91rKUZ49Zc1pP3aHN3VQ/t4s+S1He3d9Zw6TvCRfklaFGCRBSblhnFvm72 mgxSjpC8BMgLfNdwRYFavG0CK05evVn4hESLg14mu0EM8p/3ucv9t5RhEmZoo9sLOubevSycYrwaN WxW/NuzIg==; Received: from [179.95.46.242] (helo=bombadil.infradead.org) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1g8BsW-0003Eh-No; Thu, 04 Oct 2018 22:13:52 +0000 Received: from mchehab by bombadil.infradead.org with local (Exim 4.91) (envelope-from ) id 1g8BsT-0000kc-N5; Thu, 04 Oct 2018 18:13:49 -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 3/3] media: v4l2-fwnode: simplify v4l2_fwnode_reference_parse_int_props() call Date: Thu, 4 Oct 2018 18:13:48 -0400 Message-Id: <463ae4be895e592aa575d55530a615e22a1934b3.1538690587.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. Signed-off-by: Mauro Carvalho Chehab Acked-by: Sakari Ailus --- drivers/media/v4l2-core/v4l2-fwnode.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/drivers/media/v4l2-core/v4l2-fwnode.c b/drivers/media/v4l2-core/v4l2-fwnode.c index a7c2487154a4..e0cd119d6f5c 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 { @@ -1092,16 +1099,12 @@ v4l2_fwnode_reference_parse_int_props(struct device *dev, int v4l2_async_notifier_parse_fwnode_sensor_common(struct device *dev, struct v4l2_async_notifier *notifier) { + unsigned int i; 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 }, }; - unsigned int i; for (i = 0; i < ARRAY_SIZE(props); i++) { int ret; @@ -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);