From patchwork Tue Jul 12 16:33:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tommaso Merciai X-Patchwork-Id: 2109 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 313593F0D5 for ; Tue, 12 Jul 2022 18:34:09 +0200 (CEST) Received: by mail-wm1-f71.google.com with SMTP id i5-20020a1c3b05000000b003a2e8a77dd1sf906855wma.1 for ; Tue, 12 Jul 2022 09:34:09 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1657643649; cv=pass; d=google.com; s=arc-20160816; b=deVh2P3HmzPmeiGnlI+c/PgKYyjtwFO6ksJfe6dFULnSiLFhUAhzHGECao8ejBpTMW RTJVpyKseb+TjucAshKf26SOeHNi1k7WivQF5ddleYAl067MSB8VRvo+/jyeWZaD5xx8 20VdouMOdPVVJrTFGKINLvHlRGC5JBI5oTFokBBEQGzAmAqFosGwvY0sZxOXVmiH4FIR shUL6W31xTjv72pvks6xCeU5eMYMqSmufjyq1cqkh96pudU99srjuI3coK6azIbRVWfg ocOcBge14bDGuIKDgfOtyBkDkPnoQIxX95+CFuRfZMBeILWLsk+eRu9j/xJclIqsy4jV FcFA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=GJGtdhRH8kSjpKIGACFev1ZeFEfzoao3nqEaHO6Fl0Y=; b=rj+mBDEL8xFjRPGyGUU2e/kKofvmDfzZFrHIZB33ppmtU79qHeqi4rHPKMv/IBtoEo NMeoBS+xnz46yBrNF/O4/v2alvAwc5JPxVUaLXmoyXn9U2JzDhucKW/CQiiRCIhEHtpn ksLdjoy8kpx25+e2QuvAU98GR5mXhHV49RnjCZnvBNISguZiRX4JNyedxK1u0opyH1E6 O87Rp9LOWC9qgB8M8ycd46S3eaq+CajMRoyypklcSnnRVo10JLBH1VJS54Inci8F/nnz BmkgUxzv5nv9cOQbQexe0JNi9GHBvVWDeC+QonQIb/iJeuOv/lN1aHTZ0jUIFZNOtSxA A3ew== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=QIfK3LMH; spf=pass (google.com: domain of tommaso.merciai@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=tommaso.merciai@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com 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:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=GJGtdhRH8kSjpKIGACFev1ZeFEfzoao3nqEaHO6Fl0Y=; b=AYtY08ztnIuuDCZMnrc8dMDC+sfsi2XSll/1beGb32n5HvDV5/uNGc2HMYr0Zky5uG KBPy4kfw5RljoH+0XJJ9LU0iXHbamqXcx9KRFayeTe++AnNXQShT53UFx3Me8PlylfSR yCLetzdyIRlSLANNW3vTYK9NL2xOum36n8eLA= 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:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-spam-checked-in-group:list-post:list-help:list-archive :list-unsubscribe; bh=GJGtdhRH8kSjpKIGACFev1ZeFEfzoao3nqEaHO6Fl0Y=; b=tA9dHQaj16nBY3xLLWp1v310i+8j79/4UZvEIxU+dH6qCXoNCbTaUSON4GeJGoemCw igBR1JpE1God27PGTesiEbT2kWPo9gJXMJljAxmhXdvJ6Wt50cgsFiB5IHS0uQNncsyO 9B7JXES8ZynsYV37kqnAb5ecN8HHjL6TyrKdmMU8KdWOEf/dzu5T07Squ/c7mQ8Yvuk1 VcCto9xLzFcXPQ28A8zexHMo303RpdgPE5LNJkfq1xWpuTi+eA7tvPcct7xzH4nGW3HZ oHxvuS8rLRT+mzHgIOlFdXEg7L1+agIaZKwmu618uI22vtdsQ39lIXz5HaXeLoFX//wH 9SIA== X-Gm-Message-State: AJIora9DmqxAwEpBaROMwL4jmqmigZAbGJ10tRfsvvG00Rb1+h0wopnr 4ACP56CvlCFkeS6XFBSn8dMpiPzu X-Google-Smtp-Source: AGRyM1sM1C0tXTtSvNYYqt/duRma6tByKhPmzOgBsigIjJ9W2a3FpR9wDZD0D+TyIGQ0nC5bNrxx8A== X-Received: by 2002:adf:fc8d:0:b0:21d:9ba5:d2c1 with SMTP id g13-20020adffc8d000000b0021d9ba5d2c1mr14591796wrr.148.1657643648883; Tue, 12 Jul 2022 09:34:08 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:600c:34c6:b0:3a0:4f27:977f with SMTP id d6-20020a05600c34c600b003a04f27977fls1638363wmq.2.gmail; Tue, 12 Jul 2022 09:34:08 -0700 (PDT) X-Received: by 2002:a05:600c:228c:b0:3a2:e172:970 with SMTP id 12-20020a05600c228c00b003a2e1720970mr5014598wmf.194.1657643647770; Tue, 12 Jul 2022 09:34:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657643647; cv=none; d=google.com; s=arc-20160816; b=lbIZ7vXVEDP4Scbc/teiPHdpo2nWUZs7QShdm2e9jYo/q8iipQl+E/cePfmXj+bgbv jA5WFDE2N21vyIexjarzzAQKe7weFrA37JYIyC0+Kyfm6Kqj/zLze5JC30ZTeG/hPA+G wUyMcDg1T2J5ES/MfkgQnHDt/IivAHr5bwwbajOGIHHmzMdH3x9aCId3zLXLkNNoGsKz DTO35P2v/WoisT3lBp/r1ZS505eBjiUv1OX66tZhl1RtzBZKy0LAH5vvp2rzFjDonMrP ypuRRZ80TgsGV1sLK0xaZ7bCMqxdr0OXLjnVhVJTa+jetALxNp3Av/KGOC/osdpNA4lF 1EaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=jE26kz8uLkTSQmG0BFSrQuTDJo25o/aqMTxY60BA87o=; b=EpNP0B4PDxDAJ4RgzgvuYMb1kN+cN0ybJGYgG+XPOisOV9yd3SNIqsnymvN36yJun5 byc2vWB+GCP31L/sBcXfLwAvAjx4zfCRjbA1TcWCwaFMkNPM6tP6paY0GnufAGU4stfK qbJ8+v5d8cZbKmZu+Qu4oV14chuJ+lsEY/Z2o6oi2Xith/sVoVETh6ao3OQ1LSir0TAV BlorokiTPAjGyNFjPykWYJVM3R0tj6awJ5HT6AmFmrEo35rd27w+422E78G6rta/OAJs pDrQt8Bg/j7bZdNJvL/6UT9pnvei3Kl/1ue708fEeveQ/hk70mlEITrK2dLgokNIj35o d1Ow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=QIfK3LMH; spf=pass (google.com: domain of tommaso.merciai@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=tommaso.merciai@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id v10-20020adf8b4a000000b002130f1dfe10sor4012363wra.73.2022.07.12.09.34.07 for (Google Transport Security); Tue, 12 Jul 2022 09:34:07 -0700 (PDT) Received-SPF: pass (google.com: domain of tommaso.merciai@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Received: by 2002:a5d:6149:0:b0:21d:6ba7:6095 with SMTP id y9-20020a5d6149000000b0021d6ba76095mr22466762wrt.680.1657643647530; Tue, 12 Jul 2022 09:34:07 -0700 (PDT) Received: from tom-ThinkPad-T14s-Gen-2i.station (net-188-217-53-214.cust.vodafonedsl.it. [188.217.53.214]) by smtp.gmail.com with ESMTPSA id j16-20020a5d6050000000b0021db2dcd0aasm2321052wrt.108.2022.07.12.09.34.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Jul 2022 09:34:07 -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 v6 1/6] media: ov5693: count num_supplies using array_size Date: Tue, 12 Jul 2022 18:33:44 +0200 Message-Id: <20220712163349.1308540-2-tommaso.merciai@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220712163349.1308540-1-tommaso.merciai@amarulasolutions.com> References: <20220712163349.1308540-1-tommaso.merciai@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: tommaso.merciai@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=QIfK3LMH; spf=pass (google.com: domain of tommaso.merciai@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=tommaso.merciai@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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",