From patchwork Wed Jun 15 15:22:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tommaso Merciai X-Patchwork-Id: 2082 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 0CD263F1E9 for ; Wed, 15 Jun 2022 17:23:00 +0200 (CEST) Received: by mail-ed1-f72.google.com with SMTP id x8-20020a056402414800b0042d8498f50asf8814245eda.23 for ; Wed, 15 Jun 2022 08:23:00 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1655306579; cv=pass; d=google.com; s=arc-20160816; b=OQlNFidI6KqkX3GgcuCqkh0OguWr0xJ5jaJdGtoN0zZ9s5wMk/fpGX1tBJ94m32G5R DoPBddt3HlEpaVOLTbM6OjbYL4t914STZ87TaMjJFs39S38KErbT6uMKmrxBvoeD4V8d MKkPTTZRT3+D2T+akRNSuRF1ucY10+4a+x+QuRgQ9itnfSap3ogjyI7UREqE27FljiiH bDcqdpGJcUo1Rna4YFlbeY+eExtKULcNbt+FrEvCPIGI/BPTeGKQJJafsMAU3UVa3xlC +IuEUIg97kmGxWh1k78hRb5MBDIcz7evPpKYutmaJvdsMOZoo1rlcH2qmd/RJX9kd7Q/ Z1Ew== 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=vKbasTaZnmI6XhvzJiTQSQ2vfxs8RqWYsVX73TQzpls=; b=aC/YkUXCiLeX8aOBr3lvuraGLtQ/LoTiWQySnW0XfAq/AAn+sUeRj5uTUA/vBGedq6 +k8w9yX+w6Z6YlBnq5qK0XA2WyeuqRy+1++IKPd2cdQ0ZAmyk25S3qbCswP6C5nLBf8I IexDr7/N98SYna8BLvIBZZWyOvLvNtudIkqs9Knd9sYgzZ0CLdOKpQhFn6BR2b2rYuIk efdFLmZCnpFqTkjRsnX7R0GOwo286iLuyxLTbd+RFREuDjAgLY/NOgMPAC5rlViqUZfY qarWaCEHOKDSTBGoPWUtnH3RHUkNTw7qQiaroy9frgjZLWnrH+hCUOxdFkXfV+Dka0if AhRw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b="Nu5sL/19"; 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=vKbasTaZnmI6XhvzJiTQSQ2vfxs8RqWYsVX73TQzpls=; b=LqZFCMJ+RW/6C6qlInOEg1j6xiaPP/HIqtxVtqH+0rxSn5TkVSzBNy1NyfHAMbtdHN ZmFh8bL66fFE0pmZxp/C4za6bPc3QobFTRjtE5ydEeT6BFNUQPeDAoYXybW7RhsQUfpO VDA1zzO5zlMY9167/WydlQd0eolUP9QbON7Hc= 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=vKbasTaZnmI6XhvzJiTQSQ2vfxs8RqWYsVX73TQzpls=; b=03HRQXqKRDkyNtKq5g0VBLZaE1HFM/P2eTW5SLEwve1Qs2HQ18NxDE5eb4FHaxsUmA x7lt+57QJctWTH0wXVMNl29EIhs1CbtIRIdtr+qHnJ2z+/B0HCSyA1UG/KB4M+n1O73Z v8s3crv++PzwN7FB4Y+ikW6hU84ayqGyL2HydvhtHQEI1O+UqvXwIG0OfjVXXOpvuIJ/ tqRXSPwUTb1DIM2Cql9jyoQUn01cOlFpooDe6g5HYIMkBItBO62e5WDnewKoKtvG5RkY 2iPjWYwa9Kq/47w1aEwGDHk1w6xsbL+6OqBXWSNQYGV9gFgbQhqR5rI+jsYZdW5hQjih 7SKw== X-Gm-Message-State: AJIora9cnx3vh1jlmq03nWAba6PW3WGfVjF92pW9e5f2YHjzUWNJaWRy 4vefrkrmTHWygNqbEm9ho1nR6s1v X-Google-Smtp-Source: AGRyM1txkCHreJJV9+X87Yvnm4yQTUs1o+0V6GAikRVoCqp/UvdKVUa7ln2MLfB29CQ4VsdnBZFSew== X-Received: by 2002:a17:907:d8d:b0:711:d82f:5d33 with SMTP id go13-20020a1709070d8d00b00711d82f5d33mr273176ejc.595.1655306579609; Wed, 15 Jun 2022 08:22:59 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:907:97c4:b0:711:d2c2:9fa4 with SMTP id js4-20020a17090797c400b00711d2c29fa4ls120257ejc.9.gmail; Wed, 15 Jun 2022 08:22:58 -0700 (PDT) X-Received: by 2002:a17:907:2161:b0:70f:5db6:1ff2 with SMTP id rl1-20020a170907216100b0070f5db61ff2mr273554ejb.249.1655306578432; Wed, 15 Jun 2022 08:22:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655306578; cv=none; d=google.com; s=arc-20160816; b=TEQeA6VipsBV6SjqLUvOuo/w/xt6xEoL6sD75ouqaa/0T7T0UOT/aJTgwpCQ8Lj9aJ Jh4yeMqkpjZXizXAe0UCavyOxI+Y0AdZSlh883NtM192zJOZawonQDHEyTc4bDb7II8j rXvfGjM8ftJRmILRm1mkIPOH2yFLOA1gCS6x7LqVBvB4c+OYlCSmPslSelE7Bp5fbe29 7OApY1Ssxoko+ZW9olbTupfOEdSAzzcf2SLxhnf3Fa7BCfeRxXb4YtzEXHq05XYmiaoc HIQh7MCI7dMYHeYatskhkO6ur4FxPA35DHS6Ez+VkM4uoL60mFzbFrwSh1K7QnfLHrti lI3A== 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=rpdfidpXpaazosoDOCbj0RBJV66iHVFwcJEcEN756BA=; b=XOUbCVnDa/NARxrRdLoXP7yww8QLqLGRoZQuVRc1g0zxv+b7SsZm6EiGL9crh3thO+ SQsY8a5xIhiUMjH9Arh1tNiGlIHdiAiDvv4lV9fCFOAoZ9rQZr4LpnV5nn3N0sVHFHYT KUfasc5HIdG/hCIiRcFaV0xMw8zRlHZ+n7goheGiwpkirpQ/Drdk4A/PjP0N1DNOiNB9 Po7RM7KEMQfW7EVj0alZkQbe1wxt4PSpnKkBs7hLBGvvw96eclSg3UyaAqsV0jcvIUnH SZkzhEsg3fe5jx8McBe1dlTLLKwZipye7J7E1GcACFdc8nt0FRr3F3TyBJDGveyzSiGd Ec0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b="Nu5sL/19"; 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 f6-20020a17090631c600b006fe93dc60d7sor4728686ejf.95.2022.06.15.08.22.58 for (Google Transport Security); Wed, 15 Jun 2022 08:22:58 -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:a17:906:1c9:b0:712:1115:42a5 with SMTP id 9-20020a17090601c900b00712111542a5mr305552ejj.662.1655306578070; Wed, 15 Jun 2022 08:22:58 -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 a11-20020aa7cf0b000000b0042be14040c1sm9446272edy.86.2022.06.15.08.22.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Jun 2022 08:22:57 -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 1/7] media: ov5693: count num_supplies using array_size Date: Wed, 15 Jun 2022 17:22:48 +0200 Message-Id: <20220615152254.794909-2-tommaso.merciai@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220615152254.794909-1-tommaso.merciai@amarulasolutions.com> References: <20220615152254.794909-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="Nu5sL/19"; 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 --- 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",