From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9F081C48BEB for ; Wed, 21 Feb 2024 21:46:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=vZwyyMbduopL8UeLGYfhe7ZOsqLz0us18uzgRfhgofU=; b=aP6KsSYufiKXX2 3iAGin2uGrfumyNcfQQGtSBgLUXiSM6JyRuI/156F+p3GQUqaCDhaet1lBgXYVLFm+dNQeR263Xb/ gQoLLeamyeAsLGERTnaQPO1vRN2tsrLqOCaw7Sx2d8e7JdKr8LFynab2AbTNdmjIsWyKjoYScUOc/ pHrcHNpKozzAPsTzw+3ayOD6PIh9ZnzfD/xNpkLZxziHUBQFCUZLfuQ0BS6LcAMCofTT/QHNdP1v8 o91yL25+aTqd+X2dKCBXM2MGSEKh2frHxizv4NKIFoDHAHOTb8/eqnVXM0DO4U0cGnfh4RZniWeJm gRJSaJislIZLHKNM6m5g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rcuQN-00000002iIO-2fQX; Wed, 21 Feb 2024 21:46:43 +0000 Received: from mail-il1-x133.google.com ([2607:f8b0:4864:20::133]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rcuQL-00000002iGo-06xD for linux-arm-kernel@lists.infradead.org; Wed, 21 Feb 2024 21:46:42 +0000 Received: by mail-il1-x133.google.com with SMTP id e9e14a558f8ab-3651c1e1022so18182325ab.0 for ; Wed, 21 Feb 2024 13:46:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1708551999; x=1709156799; darn=lists.infradead.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=7+QKepU2MbI4a/2CEG6x48g/5yOOaTqkeikoyN0HwE4=; b=E+UcAzVl9L7nrzq/g82VDbsq4ne5scZfnAYMJGcaEpDhHkYscw+xKxb6lqMR67DIhn dTYNgTWIwVAEkrUaD4CMaqzScFX+GTCVWIFfIkDx8k1os5x/zzsRZ5A2PDHckeieZSiI rThJLvj65iHluAys+VMiFy++KW7iS0+7Kp344= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708551999; x=1709156799; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=7+QKepU2MbI4a/2CEG6x48g/5yOOaTqkeikoyN0HwE4=; b=QIKxAH6vHcJw+Eficdoja60la4pp4DbtoppLT2lHYOtQSs1JSILZFvwAKd0c9YmhlO 6ht533IxJCl0tNHRgToUFgdTvf2r92LkNp9WGE+sxeyWcTlzCLbOrawvWKjD1P+DYmKn oYZWNUJsdZdgtEavlTzBQXAESFdkVbpK7h/o16vun6GRtJgdVzZ/mLlS8RFKUuoA3uOC QmKr/2NI3husxjmhIy/+X5lZQvK1z6Rsu8zt7TFleJ/2EK3pHOAb/MQ26rtKdtod7/PT lyTD80jYI9mBltG3XrdFGej1JJArDrWF7jT80Cu2j7P7lTNROJbhp7jUZ3qNCFUFD95o Iptg== X-Forwarded-Encrypted: i=1; AJvYcCXKXtzTfc0whSg+WKuCar/Ue9aiX5ntUeBG6MA4JQo3yNPRQcIrGwkScD97XrHJ0nuYXe3QgYkJ2jSF3CQe/teaIDEJLvYm3QIDIkS7WgRdnyeLB6E= X-Gm-Message-State: AOJu0Yzm31jqeifBIlmT6ibaPexUjnRes7tp9ytYiGDYb9klnX8jKuJ+ muJTnke/Ey1M2kc62nmVPBd7tO77ioKjP9q8BFeV5m/tAFUkhkfmH6Ho3O1i6w== X-Google-Smtp-Source: AGHT+IFBUZzWY7+Gyh4073StMQynW71O1XhzOlaNGslbtvVVdGagjjqiCcd5gNO5djx/h05+c4TUWg== X-Received: by 2002:a05:6e02:c6f:b0:364:2406:992e with SMTP id f15-20020a056e020c6f00b003642406992emr20453456ilj.23.1708551998951; Wed, 21 Feb 2024 13:46:38 -0800 (PST) Received: from localhost (147.220.222.35.bc.googleusercontent.com. [35.222.220.147]) by smtp.gmail.com with UTF8SMTPSA id b11-20020a05663801ab00b00473e844f978sm456921jaq.32.2024.02.21.13.46.38 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 21 Feb 2024 13:46:38 -0800 (PST) Date: Wed, 21 Feb 2024 21:46:38 +0000 From: Matthias Kaehlcke To: Javier Carrasco Cc: Liam Girdwood , Mark Brown , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Greg Kroah-Hartman , Helen Koike , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Catalin Marinas , Will Deacon , Russell King , linux-sound@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v4 6/8] usb: misc: onboard_dev: use device supply names Message-ID: References: <20240220-onboard_xvf3500-v4-0-dc1617cc5dd4@wolfvision.net> <20240220-onboard_xvf3500-v4-6-dc1617cc5dd4@wolfvision.net> <503d9ea9-9812-498b-a5ee-2579ba8a7ecf@wolfvision.net> <6a4f1862-ccb1-4d6d-bab2-f22090a1a08b@wolfvision.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <6a4f1862-ccb1-4d6d-bab2-f22090a1a08b@wolfvision.net> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240221_134641_108525_A122D059 X-CRM114-Status: GOOD ( 36.39 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, Feb 21, 2024 at 10:33:53PM +0100, Javier Carrasco wrote: > On 21.02.24 22:18, Matthias Kaehlcke wrote: > >>>> +/* > >>>> + * Fallback supply names for backwards compatibility. If the device requires > >>>> + * more than the currently supported supplies, add a new one here, and if > >>>> + * possible, the real name supplies to the device-specific data. > >>>> + */ > >>>> +static const char * const generic_supply_names[] = { > >>>> + "vdd", > >>>> + "vdd2", > >>>> +}; > >>>> + > >>>> +#define MAX_SUPPLIES ARRAY_SIZE(generic_supply_names) > >>> > >>> This will have to change when support for a device with more than 2 non-generic > >>> supply names gets added. Please use a literal value for MAX_SUPPLIES instead of > >>> ARRAY_SIZE. If the literal is 2 it would still need to change for future devices > >>> with more supplies, but that change would be more straighforward. > >>> > >> > >> I am not completely sure about this. Someone could increase MAX_SUPPLIES > >> without adding a generic name. > > > > That's perfectly fine and intended. MAX_SUPPLIES is a max, any list > > shorther than that is valid. Any longer list will result in probe() > > being aborted with a clear error message. > > > >> Actually two modifications will be necessary for every addition (name > >> and MAX_SUPPLIES). If ARRAY_SIZE is used, only new names are required, > >> and MAX_SUPPLIES is automatically increased. > > > > As per above it's not necessary to add a new name when MAX_SUPPLIES is > > increased to support more non-generic names. It would only be necessary > > if more generic names were added, my understanding is that this > > should not happen because any newly supported onboard devices are > > supposed to use device specific supply names. I don't like to idea of > > adding unused pseudo supply names to the list, just for the sake of > > using ARRAY_SIZE. > > > >> I understand that the whole point of this is getting rid of the generic > >> names, but we still have to provide generic names for every extra > >> supply, at least for code consistency and to avoid size mismatches > >> between real an generic supply names. > > > > Please let me know if you still think the extra names are needed. > > Not really, the only case I could come up is if an existing device that > uses generic names might end up requiring a third supply, which would > also be generic. But even such an unlikely event would be cover without > ARRAY_SIZE. > > Actually one could argue that every existing device could have "vdd" and > "vdd2" as their supply names and remove checks and the generic array. Sounds good to me. Another similar option would be to assign 'generic_supply_names' to '.supply_names'. I don't have a strong preference. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel