public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
From: Conor Dooley <conor@kernel.org>
To: Krzysztof Kozlowski <krzk@kernel.org>
Cc: markus.probst@posteo.de, "Hans de Goede" <hansg@kernel.org>,
	"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
	"Bryan O'Donoghue" <bryan.odonoghue@linaro.org>,
	"Lee Jones" <lee@kernel.org>, "Pavel Machek" <pavel@kernel.org>,
	"Rob Herring" <robh@kernel.org>,
	"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
	"Conor Dooley" <conor+dt@kernel.org>,
	"Miguel Ojeda" <ojeda@kernel.org>,
	"Boqun Feng" <boqun@kernel.org>, "Gary Guo" <gary@garyguo.net>,
	"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
	"Benno Lossin" <lossin@kernel.org>,
	"Andreas Hindborg" <a.hindborg@kernel.org>,
	"Alice Ryhl" <aliceryhl@google.com>,
	"Trevor Gross" <tmgross@umich.edu>,
	"Danilo Krummrich" <dakr@kernel.org>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	"Len Brown" <lenb@kernel.org>,
	"Saravana Kannan" <saravanak@kernel.org>,
	platform-driver-x86@vger.kernel.org, linux-leds@vger.kernel.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	rust-for-linux@vger.kernel.org, linux-acpi@vger.kernel.org
Subject: Re: [PATCH v5 4/4] platform: Add initial synology microp driver
Date: Mon, 30 Mar 2026 17:31:51 +0100	[thread overview]
Message-ID: <20260330-unrefined-headache-f640bc70a46a@spud> (raw)
In-Reply-To: <6d2fb01a-216b-4f51-8a26-527d724002d7@kernel.org>

[-- Attachment #1: Type: text/plain, Size: 3373 bytes --]

On Mon, Mar 30, 2026 at 08:51:14AM +0200, Krzysztof Kozlowski wrote:
> On 29/03/2026 20:02, Markus Probst via B4 Relay wrote:
> > +
> > +kernel::of_device_table!(
> > +    pub(crate) OF_TABLE,
> > +    MODULE_OF_TABLE,
> > +    Model,
> > +    models![
> > +        apollolake @ [
> > +            ds918p,
> > +        ],
> > +        evansport @ [
> > +            ds214play,
> > +        ],
> > +        geminilakenk @ [
> > +            ds225p.led_usb_copy(),
> > +            ds425p,
> > +        ],
> > +        pineview @ [
> > +            ds710p.led_esata(),
> > +            ds1010p.led_alert(Color::Orange),
> > +        ],
> > +        r1000 @ [
> > +            ds923p,
> > +            ds723p,
> > +            ds1522p,
> > +            rs422p.led_power(Color::Green),
> > +        ],
> > +        r1000nk @ [
> > +            ds725p,
> > +        ],
> > +        rtd1296 @ [
> > +            ds118,
> > +        ],
> > +        rtd1619b @ [
> > +            ds124,
> > +            ds223.led_usb_copy(),
> > +            ds223j,
> > +        ],
> > +        v1000 @ [
> > +            ds1823xsp,
> > +            rs822p.led_power(Color::Green),
> > +            rs1221p.led_power(Color::Green),
> > +            rs1221rpp.led_power(Color::Green),
> > +        ],
> > +        v1000nk @ [
> > +            ds925p,
> > +            ds1525p,
> > +            ds1825p,
> I don't see any compatible strings here. Actually, nowhere in the
> driver. If that's how you write Rust drivers then NAK. Compatibles must
> be greppable. Not only for humans but also for ABI check.

The code immediately prior creates a macro, which is called here to
produce these. This macro is barely grokkable to begin with IMO, but
you can see the DeviceID::new() call down there that creates the
compatible using string concatenation.

Definitely on the same page as you about compatibles being greppable.
It's not as if it is difficult to create the list using vim or whatever
code generator llm you wanna use. Probably making the macro was more
effort than writing them out!

+macro_rules! models {
+    [
+        $($arch:ident $(.$arch_func:ident( $($arch_arg:tt)* ))*
+            @ [
+                $($model:ident $(.$func:ident( $($arg:tt)* ))*, )*
+            ],
+        )*
+    ] => {
+        models![
+            $(
+                {
+                    Architecture::new()
+                    $(
+                        .$arch_func($($arch_arg)*)
+                    )*
+                }
+                @
+                [
+                    $(
+                        $model $(.$func($($arg)*))*,
+                    )*
+                ],
+            )*
+        ]
+    };
+    [
+        $($arch:block
+            @ [
+                $($model:ident $(.$func:ident( $($arg:tt)* ))*, )*
+            ],
+        )*
+    ] => {
+        [
+            $(
+                $((
+                    DeviceId::new(::kernel::c_str!(
+                        ::core::concat!(
+                            "synology,",
+                            ::core::stringify!($model),
+                            "-microp",
+                        )
+                    )),
+                    Model::new($arch)
+                    $(
+                        .$func($($arg)*)
+                    )*
+                ),)*
+            )*
+        ]
+    };
+}


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

      reply	other threads:[~2026-03-30 16:31 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-29 18:02 [PATCH v5 0/4] Introduce Synology Microp driver Markus Probst via B4 Relay
2026-03-29 18:02 ` [PATCH v5 1/4] dt-bindings: embedded-controller: Add synology microp devices Markus Probst via B4 Relay
2026-03-30  6:51   ` Krzysztof Kozlowski
2026-03-30 23:38     ` Markus Probst
2026-03-29 18:02 ` [PATCH v5 2/4] ACPI: of: match PRP0001 in of_match_device Markus Probst via B4 Relay
2026-03-30  7:00   ` Krzysztof Kozlowski
2026-03-30 19:04     ` Markus Probst
2026-03-30 19:22       ` Rob Herring
2026-03-30 19:24         ` Markus Probst
2026-03-29 18:02 ` [PATCH v5 3/4] rust: add visibility to of_device_table macro Markus Probst via B4 Relay
2026-03-30  7:02   ` Krzysztof Kozlowski
2026-03-29 18:02 ` [PATCH v5 4/4] platform: Add initial synology microp driver Markus Probst via B4 Relay
2026-03-30  6:51   ` Krzysztof Kozlowski
2026-03-30 16:31     ` Conor Dooley [this message]

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=20260330-unrefined-headache-f640bc70a46a@spud \
    --to=conor@kernel.org \
    --cc=a.hindborg@kernel.org \
    --cc=aliceryhl@google.com \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun@kernel.org \
    --cc=bryan.odonoghue@linaro.org \
    --cc=conor+dt@kernel.org \
    --cc=dakr@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=gary@garyguo.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=hansg@kernel.org \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=krzk+dt@kernel.org \
    --cc=krzk@kernel.org \
    --cc=lee@kernel.org \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=lossin@kernel.org \
    --cc=markus.probst@posteo.de \
    --cc=ojeda@kernel.org \
    --cc=pavel@kernel.org \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=rafael@kernel.org \
    --cc=robh@kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=saravanak@kernel.org \
    --cc=tmgross@umich.edu \
    /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