From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6505328936E for ; Wed, 7 May 2025 14:19:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746627588; cv=none; b=hkiKylaPFtVne6hqF2+kGd/wJDo1cvfQtxfBDypQ+sWFVGXrbFIpPiUZtU/9olwp+UOz/5xHL+3iPGgbGQ6xHA+X1gPG2Y4gnE4EKr0jP4OzZLz5lHjAfXOZHFVcYbw42muaO/v+wEXNSYVZJCj+upuF0CHZIwQp+x24a2N8xCs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746627588; c=relaxed/simple; bh=+gSWaLrlSKvjhkkdwPTUbaGH52GIa8jFvFcv1TL+Qr0=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=icqapX4NK1RDF1HAqf/A+dn10eOSOcJD5k8/BmuHwcBGN1/Bl4eSbnxWKB8RXmCiMPnXMzIeBD/hVIIGpoZX1qP5eQFbi/ucX2njJvOYGfbBvx1qMZPxtVqgHvX1TSb5y7ZPoINHapTP9Pmvc8nlcwHGRABTCxJUin6HnYXSQ4k= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=L2xJe1P+; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="L2xJe1P+" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1746627585; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MweqEOF5l5jRk/Y5461YnFfXIpxXFbmEcdriDx9b/ng=; b=L2xJe1P+56VlZZk2Dvcdk3VfzSQowbu4zvfdPADBqme+bBZa6SnlpTIzaz1WGGhBQLP0iE J2t3lYQ36Ueg5xFvNdk3REpbUz3AASQD1jiyfYaE6P71FCSkmdZWPqM6WC7Ngl9Idg9Qvc m3iyj45BfWDD9SyX5nrsJwKgn3gjLCw= Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-588-MokWut8GP3WQFdyZTAATqA-1; Wed, 07 May 2025 10:19:40 -0400 X-MC-Unique: MokWut8GP3WQFdyZTAATqA-1 X-Mimecast-MFC-AGG-ID: MokWut8GP3WQFdyZTAATqA_1746627577 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 4DEDA1956050; Wed, 7 May 2025 14:19:37 +0000 (UTC) Received: from [10.44.33.91] (unknown [10.44.33.91]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 5062D1800359; Wed, 7 May 2025 14:19:31 +0000 (UTC) Message-ID: <7e7122b1-b5ff-4800-8e1d-b1532a7c1ecf@redhat.com> Date: Wed, 7 May 2025 16:19:29 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH net-next v7 8/8] mfd: zl3073x: Register DPLL sub-device during init To: Andy Shevchenko Cc: netdev@vger.kernel.org, Vadim Fedorenko , Arkadiusz Kubalewski , Jiri Pirko , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Prathosh Satish , "David S. Miller" , Jakub Kicinski , Paolo Abeni , Simon Horman , Lee Jones , Andy Shevchenko , Michal Schmidt , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org References: <20250507124358.48776-1-ivecera@redhat.com> <20250507124358.48776-9-ivecera@redhat.com> Content-Language: en-US From: Ivan Vecera In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 On 07. 05. 25 3:41 odp., Andy Shevchenko wrote: > On Wed, May 7, 2025 at 3:45 PM Ivan Vecera wrote: >> >> Register DPLL sub-devices to expose the functionality provided >> by ZL3073x chip family. Each sub-device represents one of >> the available DPLL channels. > > ... > >> +static const struct zl3073x_pdata zl3073x_pdata[ZL3073X_MAX_CHANNELS] = { >> + { .channel = 0, }, >> + { .channel = 1, }, >> + { .channel = 2, }, >> + { .channel = 3, }, >> + { .channel = 4, }, >> +}; > >> +static const struct mfd_cell zl3073x_devs[] = { >> + ZL3073X_CELL("zl3073x-dpll", 0), >> + ZL3073X_CELL("zl3073x-dpll", 1), >> + ZL3073X_CELL("zl3073x-dpll", 2), >> + ZL3073X_CELL("zl3073x-dpll", 3), >> + ZL3073X_CELL("zl3073x-dpll", 4), >> +}; > >> +#define ZL3073X_MAX_CHANNELS 5 > > Btw, wouldn't be better to keep the above lists synchronised like > > 1. Make ZL3073X_CELL() to use indexed variant > > [idx] = ... > > 2. Define the channel numbers > > and use them in both data structures. > It could be possible to drop zl3073x_pdata array and modify ZL3073X_CELL this way: #define ZL3073X_CHANNEL(_channel) \ &(const struct zl3073x_pdata) { .channel = _channel } #define ZL3073X_CELL(_name, _channel) \ MFD_CELL_BASIC(_name, NULL, ZL3073X_CHANNEL(_channel), \ sizeof(struct zl3073x_pdata), 0) WDYT? Ivan