Re: [PATCH v3 6/6] nvme-apple: Add initial Apple SoC NVMe driver

From: Arnd Bergmann
Date: Tue Apr 26 2022 - 17:07:42 EST


On Tue, Apr 26, 2022 at 10:15 PM Sven Peter <sven@xxxxxxxxxxxxx> wrote:
>
> Apple SoCs such as the M1 come with an embedded NVMe controller that
> is not attached to any PCIe bus. Additionally, it doesn't conform
> to the NVMe specification and requires a bunch of changes to command
> submission and IOMMU configuration to work.
>
> Reviewed-by: Christoph Hellwig <hch@xxxxxx>
> Signed-off-by: Sven Peter <sven@xxxxxxxxxxxxx>

I did not do a detailed review of this again, but the previous version seemed
mostly fine already.

Reviewed-by: Arnd Bergmann <arnd@xxxxxxxx>

One suggestion for a very minor improvement:

> +#ifdef CONFIG_PM_SLEEP
> +static int apple_nvme_resume(struct device *dev)
> +{
...
> +}
> +
> +static const struct dev_pm_ops apple_nvme_pm_ops = {
> + .suspend = apple_nvme_suspend,
> + .resume = apple_nvme_resume,
> +};
> +#endif
> +
> +static const struct of_device_id apple_nvme_of_match[] = {
> + { .compatible = "apple,nvme-ans2" },
> + {},
> +};
> +MODULE_DEVICE_TABLE(of, apple_nvme_of_match);
> +
> +static struct platform_driver apple_nvme_driver = {
> + .driver = {
> + .name = "nvme-apple",
> + .of_match_table = apple_nvme_of_match,
> +#ifdef CONFIG_PM_SLEEP
> + .pm = &apple_nvme_pm_ops,
> +#endif
> + },

You can now use "static DEFINE_SIMPLE_DEV_PM_OPS()" to define
the pm operations without these #ifdefs.

Arnd