Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp793225imw; Wed, 13 Jul 2022 08:07:17 -0700 (PDT) X-Google-Smtp-Source: AGRyM1v/05X29Af40R3b8syQ/A6qsLOLve25PpAIdzgjT0UGP0WLQoEx5NgzCY9PjY3ffTP0Dp0i X-Received: by 2002:a17:907:6d99:b0:726:3668:4f2a with SMTP id sb25-20020a1709076d9900b0072636684f2amr3881468ejc.627.1657724837039; Wed, 13 Jul 2022 08:07:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657724837; cv=none; d=google.com; s=arc-20160816; b=OpTAjByj5xbtuodX6h9qTapGvw9skDI8yaunPZugUde4Me2QIpV51tLPQXrUcIwtNh UkHUkGMpZKAKaHiqNDD+rnDYp4LsQEua3FXzv7330+vjL/Cas0FbrqQHVNkQxsg7sRkK WOT6r20nBUK+qKIO96dvAypdn3P0LDJyJH1ijSNn+Mz68r+iB+dVf+iChOG1ZPjdZsji cOHFe8dkqV0zkMQpG3Uo/2S+RafNcoPLjMqfP3zPZQu4OO0hWLS5Qa8tP5NbuPy4Mynw c0MaV0WNmutijg3O9MVNWTdM8i2U5URLG41nAw5+T/3K5V6WdNWH/lny71XOEVQ0U5mn WsAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=jE26kz8uLkTSQmG0BFSrQuTDJo25o/aqMTxY60BA87o=; b=LUTL1OoLBvR+xR5Csm1HK1C3Nv55E2K9PFSvz2s6AA2EoOKTXioejgjFncUq9QEf8w UlP5CceHr9Vg01QUbW6L8NBvp45ki4K7rSDGWtsxhj2QlGBkrWq9UfiL6T+ltmc+llzB mT1MP3wOxgVsqDgZJFexISgbwYqIoZN/keiH9TS1mc1jIZ+lZFf0o3+CbNt/uNqZRYdF wr9k5oOiqY98dfPq2Rg3iDaGH+E4VToE8eNoOfdeK8X+dXv0Ch/LEewzlNJ1KKI/WEOJ arZGr/NW463hKAoFLzLf+6k/SDfplJ52tjE4jqI+9WSU1UPkznYZuXBXusuW0UKc5U5B PpZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=gUbx5q33; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t19-20020a056402525300b00435705f2c71si20627399edd.439.2022.07.13.08.06.45; Wed, 13 Jul 2022 08:07:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=gUbx5q33; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236791AbiGMPF3 (ORCPT + 99 others); Wed, 13 Jul 2022 11:05:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40582 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236744AbiGMPFN (ORCPT ); Wed, 13 Jul 2022 11:05:13 -0400 Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C5E0341D35 for ; Wed, 13 Jul 2022 08:05:12 -0700 (PDT) Received: by mail-wm1-x332.google.com with SMTP id ay25so6694596wmb.1 for ; Wed, 13 Jul 2022 08:05:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=jE26kz8uLkTSQmG0BFSrQuTDJo25o/aqMTxY60BA87o=; b=gUbx5q33LywiMvhPgpaKOwbSPMBdwh4DwBxzRhs75JniMIr93Dn1/4Ci9jaQsEfgER PeMyJBJk+WS4Ogyr5bMn4TpjguNtzgtVXfB6Zt37HvLtSwphQt4naefxFhby1dedvW8L 5uIx8qPLZauFeY3yc3dyJ3aAGKv7o1E+SDHcM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=jE26kz8uLkTSQmG0BFSrQuTDJo25o/aqMTxY60BA87o=; b=Knt8QQo51SkJni4U1Ca41ADeRTsoFTZHb+pYjzpfcYzZ2+IUBi33G8NOIfjPamB9p6 XHWRgAHIaa0Z0nO7TgzKhRwc/HGC1z31fXMRvqnWMBj7rRVdqiK4acZcXA0UlEKKPhek Fd1Y9Z/3uX/MlOnlHagorVLFwYrIC+Klsvh28sgUC8zU1q+0IWDqLU2GFP4GH8Iz7iQl g+AIpjjRb7PnveFgnGaDagzWuqMy5x9+BQMwN256phgmHoF0ms4Qio/wAjfNxJkESH/P zo3DUNdzv0iq7Ox0UTLts3ned9L29kXZD6sS32xWnCw8sESSxpC/XeeXnLyZita5HxOG gDDg== X-Gm-Message-State: AJIora8V45lCQ2DDjCQXDNUj5QTej/SSr7aY5CJtdmUrInZJHhge73jx mSOnLmWClKbS8OoS50gbAv0AQw== X-Received: by 2002:a05:600c:25ce:b0:3a2:dd48:9b33 with SMTP id 14-20020a05600c25ce00b003a2dd489b33mr4202758wml.134.1657724711316; Wed, 13 Jul 2022 08:05:11 -0700 (PDT) Received: from tom-ThinkPad-T14s-Gen-2i.station (net-188-217-51-7.cust.vodafonedsl.it. [188.217.51.7]) by smtp.gmail.com with ESMTPSA id f17-20020a05600c4e9100b003a2d87aea57sm1465537wmq.10.2022.07.13.08.05.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Jul 2022 08:05:11 -0700 (PDT) From: Tommaso Merciai To: tommaso.merciai@amarulasolutions.com Cc: linuxfancy@googlegroups.com, linux-amarula@amarulasolutions.com, quentin.schulz@theobroma-systems.com, Jacopo Mondi , Daniel Scally , Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v7 1/6] media: ov5693: count num_supplies using array_size Date: Wed, 13 Jul 2022 17:05:01 +0200 Message-Id: <20220713150506.2085214-2-tommaso.merciai@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220713150506.2085214-1-tommaso.merciai@amarulasolutions.com> References: <20220713150506.2085214-1-tommaso.merciai@amarulasolutions.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Instead of hardcode OV5693_NUM_SUPPLIES in a define is better use ARRAY_SIZE function to count the number of supplies from ov5693_supply_names array Signed-off-by: Tommaso Merciai Reviewed-by: Jacopo Mondi Reviewed-by: Daniel Scally --- Changes since v3: - Add reviewed-by tag, suggested by Jacopo, Krzysztof Changes since v4: - Add Daniel reviewed-by tag drivers/media/i2c/ov5693.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/drivers/media/i2c/ov5693.c b/drivers/media/i2c/ov5693.c index 117ff5403312..f410333c4c67 100644 --- a/drivers/media/i2c/ov5693.c +++ b/drivers/media/i2c/ov5693.c @@ -127,11 +127,15 @@ #define OV5693_LINK_FREQ_419_2MHZ 419200000 #define OV5693_PIXEL_RATE 167680000 -/* Miscellaneous */ -#define OV5693_NUM_SUPPLIES 2 - #define to_ov5693_sensor(x) container_of(x, struct ov5693_device, sd) +static const char * const ov5693_supply_names[] = { + "avdd", /* Analog power */ + "dovdd", /* Digital I/O power */ +}; + +#define OV5693_NUM_SUPPLIES ARRAY_SIZE(ov5693_supply_names) + struct ov5693_reg { u32 reg; u8 val; @@ -352,11 +356,6 @@ static const s64 link_freq_menu_items[] = { OV5693_LINK_FREQ_419_2MHZ }; -static const char * const ov5693_supply_names[] = { - "avdd", - "dovdd", -}; - static const char * const ov5693_test_pattern_menu[] = { "Disabled", "Random Data", -- 2.25.1