Re: [PATCH v4 03/25] dmaengine: sdxi: Add PCI initialization
From: Lynch, Nathan
Date: Mon Nov 30 2026 - 11:53:45 EST
Hi Jonathan,
On 11/24/2026 7:01 PM, Jonathan Cameron wrote:
>> diff --git a/drivers/dma/sdxi/device.c b/drivers/dma/sdxi/device.c
>> new file mode 100644
>> index 000000000000..0974a83bb45c
>> --- /dev/null
>> +++ b/drivers/dma/sdxi/device.c
>> @@ -0,0 +1,33 @@
>> +// SPDX-License-Identifier: GPL-2.0-only
>> +/*
>> + * SDXI hardware device driver
>> + *
>> + * Copyright Advanced Micro Devices, Inc.
>> + */
>> +
>> +#include <linux/device.h>
>> +#include <linux/export.h>
>> +#include <linux/slab.h>
>> +
>> +#include "sdxi.h"
>> +
>> +int sdxi_register(struct device *dev, const struct sdxi_bus_ops *ops)
>> +{
>> + struct sdxi_dev *sdxi;
>> +
>> + sdxi = devm_kzalloc(dev, sizeof(*sdxi), GFP_KERNEL);
>
> Perhaps switch now to devm_kzalloc_obj() and avoid the churn
> if it being updated once applied. The mass change is there
> in rc3.
Yes, will do.
>> diff --git a/drivers/dma/sdxi/pci.c b/drivers/dma/sdxi/pci.c
>> new file mode 100644
>> index 000000000000..0778cde31f14
>> --- /dev/null
>> +++ b/drivers/dma/sdxi/pci.c
>
>> +
>> +static const struct sdxi_bus_ops sdxi_pci_ops = {
>> + .init = sdxi_pci_init,
>> +};
>> +
>> +static int sdxi_pci_probe(struct pci_dev *pdev,
>> + const struct pci_device_id *id)
>> +{
>> + return sdxi_register(&pdev->dev, &sdxi_pci_ops);
>
> This seems oddly miss balanced. Perhaps it's better to introduce
> an empty sdxi_unregister() ready for when it's needed later?
Fair enough, I can do that.
>
>
>> +}
>> +
>> +static void sdxi_pci_remove(struct pci_dev *pdev)
>> +{
>> + pci_disable_sriov(pdev);
>> +}
>
>> +
>> +MODULE_IMPORT_NS("SDXI");
>> +MODULE_AUTHOR("Wei Huang");
>> +MODULE_AUTHOR("Nathan Lynch");
>> +MODULE_DESCRIPTION("SDXI PCIe interface driver");
>> +MODULE_LICENSE("GPL");
>> +module_pci_driver(sdxi_driver);
>
> This is normally placed near the struct pci_driver. So before all
> the MODULE_ macros. I found a few examples of this style, but that
> one is much more common and makes sense given this is just generating
> boiler plate functions to register etc that structure.
OK.
>> +/**
>> + * struct sdxi_bus_ops - Bus-specific methods for SDXI devices.
>> + */
>> +struct sdxi_bus_ops {
>> + /**
>> + * @init: Map control registers and doorbell region, allocate
>> + * IRQ ranges. Invoked before bus-agnostic SDXI
>> + * function initialization.
>
> Trivial but comment wrap should be closer to 80 chars.
OK.