Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp360387iog; Wed, 29 Jun 2022 01:30:25 -0700 (PDT) X-Google-Smtp-Source: AGRyM1s316xpm7dvvGXoWxZhq8kyeZy7QOUYYzDVxO/qGWCB8/hV0mMbp+J3PmnlvEdSsVtoro6T X-Received: by 2002:a17:906:7ac2:b0:726:38e0:4e7d with SMTP id k2-20020a1709067ac200b0072638e04e7dmr2201832ejo.236.1656491425634; Wed, 29 Jun 2022 01:30:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656491425; cv=none; d=google.com; s=arc-20160816; b=q9TpwVmQfTjVl7UZOXVr/fRsAq8FYVivmZdhxsN5e31bA0BauzYNpsLH0SHkvUq5pU IBNbIGrOm6z6kd8F9smXoeB3k9MNHx7xTrrQE2+eleKzDdeHpvxPkwClgVcuIixHXPf+ 7VeywPLwQLDHt1gTIvIDFrI9aViXVQVdKkC4luht6jiVT0X4vrAt6Wu/qtDgtexU1Nvt h1XPnAxzOv8+iShJ5ABsgTNOOSLQgS3qP1peI1RUCDpBBk6kUd2GMNXDIIy3RvE1qK+y XUbLD1ildGAXBKt7Tfg2JQyzbp/049aifIQYGIy6lGPLMW4pLpb/zNPmr4/B6lub6cGy X81Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=hcN07n7Z5YH6hfTLvxmCZM0/81/Uu95GG0kqT+zb6N4=; b=vBRIa5fMXOyzswH9JnRgHwX/ROsAr/bTk5X2r7+kod51erRTBTObZ/Y9erQ6tAKAtt x517ldhVODyO9K5VWK+73dw1z6QJRHt+nndKh0F8VCzgLopNFe/5wszAcWDiMRFIYrOa cFbZ+BUaZdaoLKb5Pxfn6uJ9zcWnweXue2Of5BK6LCBRXxtkFllOY3GirsMjvwtCgmjT 9j7OWcflJCFsSI70Xu2w8C+T0IbKxt1aK/a9snEXyVfFsBHFtAR5T7sxC4dTXwZwbMwz Y0iyvlfryMYGPVfBxYvVU6UWaMl+EIrwAxR0aPg4zGZPdlHjVl7EHCqqfjUu0kbjn59i GcjQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hd10-20020a170907968a00b006febef95910si920787ejc.332.2022.06.29.01.29.58; Wed, 29 Jun 2022 01:30:25 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232117AbiF2H7b (ORCPT + 99 others); Wed, 29 Jun 2022 03:59:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46468 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229811AbiF2H73 (ORCPT ); Wed, 29 Jun 2022 03:59:29 -0400 Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::224]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 86FF338DAB; Wed, 29 Jun 2022 00:59:26 -0700 (PDT) Received: (Authenticated sender: jacopo@jmondi.org) by mail.gandi.net (Postfix) with ESMTPSA id 0643FE000A; Wed, 29 Jun 2022 07:59:23 +0000 (UTC) Date: Wed, 29 Jun 2022 09:59:22 +0200 From: Jacopo Mondi To: Tommaso Merciai Cc: linuxfancy@googlegroups.com, linux-amarula@amarulasolutions.com, quentin.schulz@theobroma-systems.com, Daniel Scally , Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 1/7] media: ov5693: count num_supplies using array_size Message-ID: <20220629075922.qihwbmxzolra2fkd@uno.localdomain> References: <20220627150453.220292-1-tommaso.merciai@amarulasolutions.com> <20220627150453.220292-2-tommaso.merciai@amarulasolutions.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20220627150453.220292-2-tommaso.merciai@amarulasolutions.com> X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_NONE,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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Tommaso On Mon, Jun 27, 2022 at 05:04:47PM +0200, Tommaso Merciai wrote: > 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 thanks j > --- > 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 >