Thread (26 messages) 26 messages, 3 authors, 2025-06-12

Re: [PATCH net-next v7 8/8] mfd: zl3073x: Register DPLL sub-device during init

flat view

From: Ivan Vecera <ivecera@redhat.com>
Date: 2025-05-07 14:19:46
Also in: linux-devicetree, linux-doc, lkml


On 07. 05. 25 3:41 odp., Andy Shevchenko wrote:
On Wed, May 7, 2025 at 3:45 PM Ivan Vecera [off-list ref] wrote:
quoted
Register DPLL sub-devices to expose the functionality provided
by ZL3073x chip family. Each sub-device represents one of
the available DPLL channels.
...
quoted
+static const struct zl3073x_pdata zl3073x_pdata[ZL3073X_MAX_CHANNELS] = {
+       { .channel = 0, },
+       { .channel = 1, },
+       { .channel = 2, },
+       { .channel = 3, },
+       { .channel = 4, },
+};
quoted
+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),
+};
quoted
+#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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help