Subject: Re: [PATCH net-next v3] net: txgbe: Add build support for txgbe

From: Andrew Lunn <[email-masked]>
Date: Sat, 28 May 2022 03:29:40 +0200

> +
> +err_sw_init:
> +	devm_iounmap(&pdev->dev, adapter->io_addr);

You should not need this. That is the point of the devm_ API, it gets
released automatically either when probe fails, or after the release
method is called.

> +static struct pci_driver txgbe_driver = {
> +	.name     = txgbe_driver_name,
> +	.id_table = txgbe_pci_tbl,
> +	.probe    = txgbe_probe,
> +	.remove   = txgbe_remove,
> +	.shutdown = txgbe_shutdown,
> +};
> +
> +/**
> + * txgbe_init_module - Driver Registration Routine
> + *
> + * txgbe_init_module is the first routine called when the driver is
> + * loaded. All it does is register with the PCI subsystem.
> + **/
> +static int __init txgbe_init_module(void)
> +{
> +	int ret;
> +
> +	ret = pci_register_driver(&txgbe_driver);
> +	return ret;
> +}
> +
> +module_init(txgbe_init_module);
> +
> +/**
> + * txgbe_exit_module - Driver Exit Cleanup Routine
> + *
> + * txgbe_exit_module is called just before the driver is removed
> + * from memory.
> + **/
> +static void __exit txgbe_exit_module(void)
> +{
> +	pci_unregister_driver(&txgbe_driver);
> +}

It looks like you should be able to use module_pci_driver().

   Andrew