From patchwork Thu Jun 16 19:35:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tommaso Merciai X-Patchwork-Id: 2090 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id EECD13F1D5 for ; Thu, 16 Jun 2022 21:36:05 +0200 (CEST) Received: by mail-ed1-f72.google.com with SMTP id w22-20020a05640234d600b0043559f4c95asf799813edc.18 for ; Thu, 16 Jun 2022 12:36:05 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1655408165; cv=pass; d=google.com; s=arc-20160816; b=d3aB4hi1oR8o5OntCGz9YjhJY3ZMjYzw9ejGKAnSCuiik9H5rza2kxiDfrECgD1ie6 qE5b8TXUIueMBILtK1YzWRrZvFd4vTchxLMLSdQ6zr7svLzfo8drrTc9DGA1/8PY0Cuy /w32RDj8QpHmW9fVnb5Eak1eKFqc/FJ4CKU02nKAaBV83gkl93LeEXpEdSshF6mu9JaO AjFiI58EztZ8ViBNHl53EOtaOp+Oiv3vZhp2tqGksLYnsBH9EijITJS68jINEQm3e8x9 wXa/mFlfTaFpjBk/Ibsl3x3JIi/figFk6IiqN7LVKPrjA8pZcE5/R/Sam7wA0KiYtrDn f6HQ== 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=Qb7mwVc1mZ647uZVoMN0I0OFFx+R9eSDy0PHA7LrraY=; b=05FMZlbrfTW+VJxiTPhQJfM6zb5v6wLM8QLo3ooQEFYIRmn3agHMSNF9HAfLWUpgg7 P/2QmMSZmEfOWM6IHuzhNlDsTj7Wpzwo/IVU9xpMzBovUAXejIkO21dma8g5OO7aWHbk 9m1O+Bn0D47nI0AAo3N0xhbxqMZf4X4c5FEYKP3h2fpkYXkUskQJQ/HI6l0MRl0SZXcA TUAsgAABBzmOjqaRO3QXz3Gi7YNmntV0TguFkrhSnqlxJTCY+81IQUChKCfg6DtzTblr gwB5zPFZMlZNCpsQnqTeMxzX8oy1wGPh5xFTF+Nbg3Thk5JrAOubzTsFlmuxi7KE+ohy Am8w== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b="kr5f/MW6"; 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=Qb7mwVc1mZ647uZVoMN0I0OFFx+R9eSDy0PHA7LrraY=; b=IZINNJiRCFEhvuAFzYrSRGtm8IMg77M2P3iUtBz/+BQCfcaN0PY+kpSZZbOGDVeI06 pUWMCUjwLtxe6k2aElN0hT8LqOW/tmXPV5CJc3W4mDLZ7lZJXMoC++tYtqP1FFEaD91g k6k4RyjhV5cwGRN84RQdZVDlXpm4qaGgqw9e4= 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=Qb7mwVc1mZ647uZVoMN0I0OFFx+R9eSDy0PHA7LrraY=; b=OYTtpqB/YcOAXY1OOHn+6jEprbwcq02QNO0F0wgLlsjNqxQkBwQRx5nKXpjkbFewQ4 vPm/rYItu7sIS9avp6ZAcf7NE8f55IESg5eVS5Zy+nQ3X8GUGYE7pHcNOVxclbdhL91P PNrHRPYZOYENow5wM1peMYL44Z2bdAr1mExjATFsCM4GyhNYMhw3iO4lzkRQbjjLZ+Xv l9kQxsJDEgmTS0H9hfRx2bQGSCSjklaCeKxhnMm6PXnq9bNrD7BUN+9moEZsSryL3thY jnDUPdXFCUEUbm+BbfaVgUYQpu2pa7fY6frlBjMlm/hr0CpHQGoMA80wTZFleShsj+gK GjBg== X-Gm-Message-State: AJIora8nmQlbUmV2CTPSuo4om8UfZhcmjnjxCnlHY9CqarFBwKeL74/x 2dbZW6uKodJqFLEAR3gR0hACCUy3 X-Google-Smtp-Source: AGRyM1s7mjOOfN3wXTX4Y5Jg0W0ZUEa4X3eDIdzFtpgFFvO7XE7PDpGmqR8aefOzl15S9drYtPrHpA== X-Received: by 2002:a17:906:5197:b0:712:2223:d3d0 with SMTP id y23-20020a170906519700b007122223d3d0mr6057951ejk.74.1655408165640; Thu, 16 Jun 2022 12:36:05 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:6402:35d0:b0:434:fe11:7447 with SMTP id z16-20020a05640235d000b00434fe117447ls201066edc.3.gmail; Thu, 16 Jun 2022 12:36:04 -0700 (PDT) X-Received: by 2002:a05:6402:5114:b0:42f:b5f3:1f96 with SMTP id m20-20020a056402511400b0042fb5f31f96mr8539732edd.260.1655408164576; Thu, 16 Jun 2022 12:36:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655408164; cv=none; d=google.com; s=arc-20160816; b=aHFuQ8pcsV4hQdCgtjrKF5xCZKgK1Bn8YPI1ICkycup8wuEqKOf0hr/M1jC4JGOJnc KT0Bz42TX+pzOa33QuEGGi0IaD316DaiAW4a6tQFdW5NqbUpm5qSZ2vVbKwB7v6JUL9H udpArrcLXX/B7l4cmwaO8xeLunqI6N6VULgRd5YYM5c9Wg7FNPkdwxwjZFhvKLUld5rv JTTijAQ3uEUXjmbayVWej0w1WYcVt8Rgc+C4r1/epvMYYMs/A8Q5IWqmT6OXY8zR1zmy BJNH2mBWIlSQ+5etN0Dxh4WuSmghg0ZE1LZylMll0heZslObmoTj6p54N0seqfAFT+Hc BdzQ== 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=PfwQ1+SHFcz+b/nBJI5ZLj10Ytkkbr7VGW8sb/obm3Q=; b=nys/9AM5sk6U8QHR2w5FKWWyuGVBaqUv5hbeQr0fBnRzbbpMt+JXqoOP8DkuetfgPl Hn7Tp/SwSrhLDsB0hLFDQOQCnjA2q7OcWGhQouiA68Roy5C4/Ht3AG0Gud+EY9PjWCkO OTv9+L+HpRW/diEimqvzpqJUrnNo0lm0j7rJLG0l8FG59lnpRzKX+wfLgYhbDY3qf1iC EneJXjODshwUPJ1SXFhsjvKkvsh0oizsVtzyXKOnzYu4bWeXzLh4EDWyjR6bDst2a9OF vI1S+0IQkgB5JliKidiNRJxHcdOFkRzYT4TagzwRjVZyBBNBTVeMy6t8pL1y6LBB7bT1 tPUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b="kr5f/MW6"; 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 f20-20020a50d554000000b004288e77d84dsor1924937edj.20.2022.06.16.12.36.04 for (Google Transport Security); Thu, 16 Jun 2022 12:36:04 -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:a05:6402:51c7:b0:42d:f4ea:c09 with SMTP id r7-20020a05640251c700b0042df4ea0c09mr8297489edd.319.1655408164247; Thu, 16 Jun 2022 12:36:04 -0700 (PDT) Received: from tom-ThinkPad-T14s-Gen-2i.station (net-188-217-51-34.cust.vodafonedsl.it. [188.217.51.34]) by smtp.gmail.com with ESMTPSA id x24-20020a170906711800b006fec2097d53sm1130255ejj.118.2022.06.16.12.36.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Jun 2022 12:36:04 -0700 (PDT) From: Tommaso Merciai To: Cc: linux-amarula@amarulasolutions.com, michael@amarulasolutions.com, dario.binacchi@amarulasolutions.com, angelo@amarulasolutions.com, Tommaso Merciai Subject: [PATCH v2 1/6] media: ov5693: count num_supplies using array_size Date: Thu, 16 Jun 2022 21:35:55 +0200 Message-Id: <20220616193600.1835-2-tommaso.merciai@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220616193600.1835-1-tommaso.merciai@amarulasolutions.com> References: <20220616193600.1835-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="kr5f/MW6"; 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: Dario Binacchi --- Changes since v1: - Add 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",