From: Krzysztof Kozlowski <krzk@kernel.org>
To: Kaustabh Chakraborty <kauschluss@disroot.org>,
Vinod Koul <vkoul@kernel.org>,
Kishon Vijay Abraham I <kishon@kernel.org>,
Alim Akhtar <alim.akhtar@samsung.com>,
Neil Armstrong <neil.armstrong@linaro.org>
Cc: linux-phy@lists.infradead.org,
linux-arm-kernel@lists.infradead.org,
linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] phy: exynos-mipi-video: allow skipping absent PHYs
Date: Sat, 5 Jul 2025 10:35:08 +0200 [thread overview]
Message-ID: <ff887aaf-966a-41ff-a905-f791820136fd@kernel.org> (raw)
In-Reply-To: <20250627-exynos7870-mipi-phy-fix-v1-2-2eefab8b50df@disroot.org>
On 26/06/2025 22:01, Kaustabh Chakraborty wrote:
>
> struct mipi_phy_device_desc {
> - int num_phys;
> int num_regmaps;
> const char *regmap_names[EXYNOS_MIPI_REGMAPS_NUM];
> struct exynos_mipi_phy_desc {
> + bool present;
> enum exynos_mipi_phy_id coupled_phy_id;
> u32 enable_val;
> unsigned int enable_reg;
> @@ -54,10 +54,9 @@ struct mipi_phy_device_desc {
> static const struct mipi_phy_device_desc s5pv210_mipi_phy = {
> .num_regmaps = 1,
> .regmap_names = {"syscon"},
> - .num_phys = 4,
> .phys = {
> - {
> - /* EXYNOS_MIPI_PHY_ID_CSIS0 */
> + [EXYNOS_MIPI_PHY_ID_CSIS0] = {
This should be a separate change... but overall I don't like existing
idea and I think your change is a reason to fix actual code style issue:
It is expected that each variant will define static const array and then
you assign in:
static const struct mipi_phy_device_desc exynos5420_mipi_phy = {
.phys = exynos5420_mipi_phys_data
}
which means:
1. You don't waste space for unused entries (now you always allocate 5
entries, even if you have one phy)
2. You can count them easily - ARRAY_SIZE
3. Index in the array won't the the phy ID, so you need a separate ID
member for that
4. You do not need this odd 'present' field, because really code which
is not initalized should mean 'not present' and it should be never
needed to initialize additionally to indicate 'yes, I do exist' beyond
basic initializations.
Best regards,
Krzysztof
next prev parent reply other threads:[~2025-07-05 8:35 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-26 20:01 [PATCH 0/2] Fixes for Exynos7870 MIPI PHY support Kaustabh Chakraborty
2025-06-26 20:01 ` [PATCH 1/2] phy: exynos-mipi-video: correct cam0 sysreg compatible for exynos7870 Kaustabh Chakraborty
2025-07-05 8:26 ` Krzysztof Kozlowski
2025-06-26 20:01 ` [PATCH 2/2] phy: exynos-mipi-video: allow skipping absent PHYs Kaustabh Chakraborty
2025-07-05 8:35 ` Krzysztof Kozlowski [this message]
2025-07-07 18:19 ` Kaustabh Chakraborty
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ff887aaf-966a-41ff-a905-f791820136fd@kernel.org \
--to=krzk@kernel.org \
--cc=alim.akhtar@samsung.com \
--cc=kauschluss@disroot.org \
--cc=kishon@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-phy@lists.infradead.org \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=neil.armstrong@linaro.org \
--cc=vkoul@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®