Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp850103iog; Fri, 24 Jun 2022 16:05:28 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vRNAXUDpbjOOKhp8i/+gK1cdq+w0A8hARzgjLHiuF+dNqN7WS77EjIu//uu3B730wi/oYx X-Received: by 2002:a05:6402:f29:b0:435:c108:58f2 with SMTP id i41-20020a0564020f2900b00435c10858f2mr1717186eda.401.1656111927885; Fri, 24 Jun 2022 16:05:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656111927; cv=none; d=google.com; s=arc-20160816; b=T2vgPVMTOMbpgSNcTpUSNeWVu1XNc4x7OYEP0mP49oFeQv1JVRV/ofU1hFmh04tNjT 1JlRYgxwtAQYcv4haTVExnR4iHIqungdfpfBEoOgw8hFoBClvVzzjPT97VV+3Sc+rEht FC6hLzbLD4PBhu1Ruh93F2O3G1ZgqJOBcjILJLxJkYGDJll+Mq+GwxcJ33myKDJ0sR+b KXlJ58/Evim9NsSR1OoNHS7RzblukuDz421d908NS7QDQSD6tb04L4sqOcrIotWmnVTf FDQFIOWaaNbXwxEWOsG1/NEL3dHkfxD8lFHEnHpcm4BluTu1aTAp42EwB/3YOaFfTSxJ RJ6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:from :dkim-signature; bh=rpdfidpXpaazosoDOCbj0RBJV66iHVFwcJEcEN756BA=; b=H1LsVocPdwlAg6NLnp7Tb+63R1BhWBuwPqZSN18Ho9jgbWf6t633TIjmfG5q2SPeX3 Bxrta0dfslKhk9g8aajckUExnHHTFvRMi/Irxd9TD7GRir0ufsL9rcr8nm0+M63Xi9aN vuY5r/ibB5BtErcTh+VSv7ZUFSS5vuo/PEBSd9RFqcqRiSsMiHdOEyZzqh++c+HjrO8q LyYFP8uMEQxAdaNwyXUK4rVeRqsM2Ibjjoz0j/UwoSBM5WHbarjyYOOmBLy5oIXQ/UCq XFDhgDnwt8D0oVLWLU45a856IYpCFUmjYfYZOngzrt5f33qkmdjgaLAxt3P8mKLr7d5m gH+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@amarulasolutions.com header.s=google header.b=cdPlkqVc; 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=fail (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 sa23-20020a1709076d1700b00722d84b7945si3732882ejc.918.2022.06.24.16.05.01; Fri, 24 Jun 2022 16:05:27 -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=fail header.i=@amarulasolutions.com header.s=google header.b=cdPlkqVc; 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=fail (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231537AbiFXXDc (ORCPT + 99 others); Fri, 24 Jun 2022 19:03:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37400 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231144AbiFXXDa (ORCPT ); Fri, 24 Jun 2022 19:03:30 -0400 Received: from mail-ej1-x635.google.com (mail-ej1-x635.google.com [IPv6:2a00:1450:4864:20::635]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 23E4051E54 for ; Fri, 24 Jun 2022 16:03:29 -0700 (PDT) Received: by mail-ej1-x635.google.com with SMTP id g26so7527977ejb.5 for ; Fri, 24 Jun 2022 16:03:29 -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=rpdfidpXpaazosoDOCbj0RBJV66iHVFwcJEcEN756BA=; b=cdPlkqVcoWoSFU8LRn4IpAsmIYKReNGfIdPxoZMdkRPq2WFoQ9nr5dwMnG5+weD/sD J02wws+Qe4SgAoovSNOpaoRrnein1CmTagwuoj5Hqn6R/rFLDJRmczsefN1Sr14YtW4Q IUJD4oJeb/wtkA8EmCsv/ei3y3hrvU0TUrwDs= 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=rpdfidpXpaazosoDOCbj0RBJV66iHVFwcJEcEN756BA=; b=Bm/Utk6YJdAJ4GdvrsykqB/t5gIphoBR/qEbuYLM9le4602P2CAf6KY0PlyD25tC10 nJN8WGPQQmdNFxkMFYS0xnMCfiSEb2QrUB6ZB5BgRypxnNywpMSqUTfEgIOsRzXVqc1x IaGIBtBCUINxtn5rfzbvdZcptxYSPHHC8G7PINc7Wn6Tu9Vwvkvn+UoKIvMOmdUun+1D sEj3teQaPSs4NNlkWWFOgvKhU4tYFiN8mJepHO1YdRNZVDzGi7khshKwgowhzSGD5Uqg JXvC9dQGJWjFYXNZCopOzD3lSXdUdX6oKewjn3TXfcL/sXg/XFu71ykAFw2559S1xVe6 NdIg== X-Gm-Message-State: AJIora8j9SKCz5jPGtL+aLZHKXCVqVw36aRRIi8+SvuVWy93/6LgrgcK ki2anXFo/Exe1raELxXSEFRC5w== X-Received: by 2002:a17:907:2d2a:b0:726:3527:60ac with SMTP id gs42-20020a1709072d2a00b00726352760acmr1262045ejc.661.1656111807720; Fri, 24 Jun 2022 16:03:27 -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 w1-20020aa7da41000000b004356a647d08sm2880291eds.94.2022.06.24.16.03.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jun 2022 16:03:27 -0700 (PDT) From: Tommaso Merciai Cc: linuxfancy@googlegroups.com, linux-amarula@amarulasolutions.com, quentin.schulz@theobroma-systems.com, Tommaso Merciai , Daniel Scally , Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/7] media: ov5693: count num_supplies using array_size Date: Sat, 25 Jun 2022 01:03:01 +0200 Message-Id: <20220624230307.3066530-2-tommaso.merciai@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220624230307.3066530-1-tommaso.merciai@amarulasolutions.com> References: <20220624230307.3066530-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 To: unlisted-recipients:; (no To-header on input) 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 --- 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