Re: [PATCH v2 7/9] nvme: apple: Add Apple A11 support

From: Christoph Hellwig
Date: Tue Aug 19 2025 - 04:31:10 EST


On Mon, Aug 18, 2025 at 04:43:00PM +0800, Nick Chan wrote:
> };
>
> +struct apple_nvme_hw {
> + bool has_lsq_nvmmu;
> + u32 max_queue_depth;
> + void (*submit_cmd)(struct apple_nvme_queue *q, struct nvme_command *cmd);

Please stick to 80 character lines for the NVMe code.

Also I don't think an indirect call here is a good idea. This is right
in the command submission fast path. A simple branch will be a lot
faster.

> +
> + if (q->is_adminq)
> + memcpy(&q->sqes[tag], cmd, sizeof(*cmd));
> + else
> + memcpy((void *)q->sqes + (tag << APPLE_NVME_IOSQES), cmd, sizeof(*cmd));

This could use a helper and / or comment to make the calculation
more obvious.

> + anv->hw = (const struct apple_nvme_hw *)of_device_get_match_data(&pdev->dev);

Do we even need this cast?