Received: by 2002:a05:7412:d384:b0:fc:a2b0:25d7 with SMTP id bq4csp12692rdb; Wed, 21 Feb 2024 14:05:29 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCX3dJ8J3ROXwYg24/yl436yjGR05gXLOcQbrHDmAisIfUcIvEYTrzqYc8WDg9viAMaVQ1frGywP2tiOEWUzaASVJ/yP1nrh8s1Z4piUQw== X-Google-Smtp-Source: AGHT+IGJUgacFx+zvFJ9tsyYLIdTsH/yt+xxKXZDMDwJHAnzrVuQ729pq5Fj1a6THf6ol+y+PdZG X-Received: by 2002:a17:90b:2e8f:b0:29a:2146:70ed with SMTP id sn15-20020a17090b2e8f00b0029a214670edmr2366435pjb.22.1708553129173; Wed, 21 Feb 2024 14:05:29 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708553129; cv=pass; d=google.com; s=arc-20160816; b=GxOkiN+7Abd+RNJ6EJ6GR05q3faYtAu/B3Pa2L2aT+Puj+cdfPoy8fVcTUIoNx2kr/ bIw4kpY++pRcgK+Sr2WB9OKgaZvwGohdEGRPnUwTK7u9C3rgitB7BDknXqifgV0AR5XE rXxMmJzdhWULNJlQ5P2Fz1I8DbTcWDe1VQiHZmN2XtEFDue0xqD/vW6XVN+TrlqoFqJA DbPhqRUjt3tAjonBypAMckJ3nczunEVP+z/kQQdqKO8ZOVAzGV7SrI9JW/DBPITkqWTF arhIvhSQJoFqeDfSClnkKG33iTe0sSDmRTC5yYZeUCXb4GzHsaJeLafJRPViVS6ytuod JkzQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=7+QKepU2MbI4a/2CEG6x48g/5yOOaTqkeikoyN0HwE4=; fh=DJMtgGHD+Ra05F7TKMSyvKwohNrHWud8wD7sYWzaLGE=; b=T0ygOE8DTk9Lh5JYkm1D+eqcM222/I3uoFe1cK1ONSmqJZ62VPgNA/5DEZ2Ud+vxMO WYWg/+b7x/bQ6REg0Y0moTAh4fLXNvJhsdLGBoF8Ga5wcxf2Cz2nhc7on9B+y7BpR08W CdlSyX+ed9/8UxTsJDov25Y1KxgYyNFmPKazh/6vweZn5Q/l6CC73aK6eWQBNam27uvU F4Ujlnb+OQpY4Faw34aQk4R0JdMOWrTXI+bLGcf/PHbsVbnrpkpa1hMJJxxxv64tVBwU 6ePu+7uGjKFXsmbMQ666hKiMpNMsHuKole2GRthWpB5ZUj+bbq8HRPDZP0zvG3KU97PC 2Wug==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=KdPSqg9w; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-75572-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-75572-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id me13-20020a17090b17cd00b002993be51a7dsi2317356pjb.163.2024.02.21.14.05.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Feb 2024 14:05:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-75572-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=KdPSqg9w; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-75572-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-75572-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id E4DC5B27906 for ; Wed, 21 Feb 2024 21:47:15 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2D995128814; Wed, 21 Feb 2024 21:46:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="KdPSqg9w" Received: from mail-il1-f173.google.com (mail-il1-f173.google.com [209.85.166.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BBEDE127B66 for ; Wed, 21 Feb 2024 21:46:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.173 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708552001; cv=none; b=iKpzk90IaWdLRM8JI0MAOxrO3/1NGGgApNM/2Dfl4F+5QTndlk6rOIFh0sKuTqIhZtXCzo1XcNQ7J17Zo+igTSNjO03uvk05xTfmrSAHU296ik8lVO3x14l883Cq0snkJMsH5ZJhvjWaFZzQlvUGyEH5oKpCqxuMInMy1k3RH/w= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708552001; c=relaxed/simple; bh=of9bAtEogX5ECgh9Cm9HB0yowv3h3jorHP2cz4TfNmI=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=NXfnuzniEzfXPWs1Sae/HinPn2NcjpcD1b0+sr7xGr/l2Obc26ewxxZ1yCirWMRKKcwqd8tBstrC9QPzWs9tw+6vKd5JqdSIDvS56uPAt419pDR4VCujwc0wlJZQ8MPz46PuUGgIg6cd7cwcRdLuCw9mLLxSGiOKL3sfIh6IiG4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=KdPSqg9w; arc=none smtp.client-ip=209.85.166.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Received: by mail-il1-f173.google.com with SMTP id e9e14a558f8ab-3651c1e1022so18182305ab.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=vger.kernel.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=KdPSqg9w51T7mvoBvMapZ4uHalkw+HZdr4AM5nOb1DMOYnXNzQRN4VRJV444r/39Bb Zril6J9mHKplS8MH0XzLxng943Uec2oSGERvWfGSe4QgYZnQNiMwiVBfiWQZULj2An9A Co1H9UGeJf6uJqacJPwgeGAa1eKs2bWERAYu8= 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=srVXXnKOYIaVMCtbYFaaElCcULMHeVWzQBMXYGR6XTSDo6bqj23BDMkGlMVLxG9PwG n1kphbIOff63J5n7ssQ/TuNj5EzGd0yc6dB64/Ul1GtclCqwdhcSfiff4Y8I5ub4FgKS TFJA0ZnzR0Ckm98LK5O4H9/VYNA5KGRn+f9vaefCoH876rtfP1ouPYnYPOEJoInLLgHS /WR4NBHc/RVTkDPAJDj7nOpbbtYLndGb1E/B/2/VJlhN1FV1L5Sq1S04ohb1mzXMExWQ mCq0IafYDMrt27D3vFC6pDISzghhzaOGrm9cKZF66uop1z7mp7dThOThrFX4Br5iOpYQ 7bNA== X-Forwarded-Encrypted: i=1; AJvYcCXGiMpLtGGAzd4U578prXf4K3lmzYwrkunP5O6vswgvD3QJGl6Xy1qEZ0aXuHZbSVqAl3fLyesANq9Szfka3rDMkAfD0Su53xn1JXPN X-Gm-Message-State: AOJu0Yy3iauk+S9oxdFAN4BDyyt7zq0DenMPcvD6szXNOFNerWLwgX7m w5gYgR5SZ6oKlw6tZcj771JtYDDUkVnkWUmGU8Qw2/3nuWt3t34oc4orEdMX5g== 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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <6a4f1862-ccb1-4d6d-bab2-f22090a1a08b@wolfvision.net> 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.