Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp655283iog; Thu, 30 Jun 2022 07:47:17 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vZBNRbjfTKfW0oYL5ivrFocqzLRLzG7TyF6LX+WbZEd4deq+RUc7+onMVvkoR5su2h1tnM X-Received: by 2002:a17:907:7f22:b0:726:8962:d5a6 with SMTP id qf34-20020a1709077f2200b007268962d5a6mr9442310ejc.717.1656600437510; Thu, 30 Jun 2022 07:47:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656600437; cv=none; d=google.com; s=arc-20160816; b=NSkPE3k5/Qgg1nqg04lzdNSnY6v8EkGUaJ4uNm0WCKp1RDef2xDyb6vlAO5riPzUp/ 6l49LTW1LTTottYqEWwYF1029nGfcMru8H6AE+wS4pAvWuIEmQmYZpiVzieT9wa3NQWx RtgZ0h39vddW0q8lz94TLKz0kt9H+3UEGV+OMVYEDWQ70bA8dtQooWmYHzBJWoIP9g+K bzrwgN4+B7T/uMoblA1oupFE4Xu//Ya/lWOZitXBOalgxc1ptD50xQaIvJlG27HuflUi 6WUJd74tnHOaccyedub1UPyrqrTqUEat6eL6aj7iK7nvhd5/BGfmVE/OGtWrHexRGfjx 6Kgw== 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=hAkY2GSeVZ5cGhVMBHLKVQ9gRRB85xDP6zjIM7d6MT1t+GXquCZNh6LTLy8fUktGK/ n7TlG5Cqb35iDYGPnWlfV2XzkD8iWNIuWAPMzyyiZDIrPIB496fZelWRdi+KDqt3IrfH 3lXbw0nzVnao9QoTBB4QM3gqCSttgLtx/GpiP0PNhcQbjnVZrVZda+cwjtKNaLXPqWBo HtlGIeiTWBHeZaWCJN48epUVSOLc3LgMAlaF5w1LJmwrrIhSQgIIfIRLgKhlXPoPD0xU zE8SbpzGKqazcRs3MyjhR79AR4nLLkykUaA0IMavZ1phwVyGl40svnekdKDVdIVyK5Uu z5zw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=TjBJe4l2; 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 m19-20020a056402511300b00435b22ef9b4si4774019edd.609.2022.06.30.07.46.52; Thu, 30 Jun 2022 07:47: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=TjBJe4l2; 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 S235587AbiF3NuA (ORCPT + 99 others); Thu, 30 Jun 2022 09:50:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51442 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235455AbiF3NtL (ORCPT ); Thu, 30 Jun 2022 09:49:11 -0400 Received: from mail-ed1-x52f.google.com (mail-ed1-x52f.google.com [IPv6:2a00:1450:4864:20::52f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4AFC233347 for ; Thu, 30 Jun 2022 06:48:42 -0700 (PDT) Received: by mail-ed1-x52f.google.com with SMTP id eq6so26599556edb.6 for ; Thu, 30 Jun 2022 06:48:42 -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=TjBJe4l27BlUK69/w9aTMBarDu8Hu5rsMI3YPuojTUPjti+DtWbeez4JTqjDFoBeCC 4CZtxGHVq2VnWJD5DvM38qcux3B8HyI9Xg8OrP2idCpv7Mwz/L87esvTQcbeW5IV5aEh kXb0aqoVsHj1slf6mWtRUMYv8iIKOck2Jf5sc= 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=n9Gy9M6adqUNcwSPXAOMQHu358zsiaWA1mGYNkPuI9B4R7RyXlAOJ2/Hd0wuJRdPFS Hy7w+oSRSgQqKoXvfzpWO8pbR3VbYA4uySVStmcKJ7jMr0src/lzEry2UXX+1+pxGRnB GU2k+Imy3AUQyMxvIUD1INe/clEZb3f+aK0/C7TUO1cscfB3SqPRf748ds4Ud9uQ7Waq y6ih8DrDzkwa5JtMvcctwM1CanyP42FbKR+k5EFdhCP7n8aCEKSOmZHgnRZIWLzK+VgY 6yVUc1XBoHbgH1fSNa1E9NCYwST8kRY31TrjIcKYEZzIDbHUpOVqrt5QyKGb9XnQIYGs c7qw== X-Gm-Message-State: AJIora/LPmh/JrP0lHyhlbeLJdjFzpu0jWqcdIbXjmDZAltZeca0X8+C yXxSzUhT/kdh6/tg565NFU+gygeTCBaPrg== X-Received: by 2002:a05:6402:40cc:b0:435:912b:257a with SMTP id z12-20020a05640240cc00b00435912b257amr11702414edb.380.1656596921341; Thu, 30 Jun 2022 06:48:41 -0700 (PDT) Received: from tom-ThinkPad-T14s-Gen-2i.station (net-188-217-58-216.cust.vodafonedsl.it. [188.217.58.216]) by smtp.gmail.com with ESMTPSA id k5-20020a1709067ac500b006fee526ed72sm9130288ejo.217.2022.06.30.06.48.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Jun 2022 06:48:41 -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 v5 1/6] media: ov5693: count num_supplies using array_size Date: Thu, 30 Jun 2022 15:48:30 +0200 Message-Id: <20220630134835.592521-2-tommaso.merciai@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220630134835.592521-1-tommaso.merciai@amarulasolutions.com> References: <20220630134835.592521-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=unavailable 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