drivers/net/ethernet/ti/tlan.c

Source file repositories/reference/linux-study-clean/drivers/net/ethernet/ti/tlan.c

File Facts

System
Linux kernel
Corpus path
drivers/net/ethernet/ti/tlan.c
Extension
.c
Size
87989 bytes
Lines
3265
Domain
Driver Families
Bucket
drivers/net
Inferred role
Driver Families: operation-table or driver-model contract
Status
pattern implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

static struct pci_driver tlan_driver = {
	.name		= "tlan",
	.id_table	= tlan_pci_tbl,
	.probe		= tlan_init_one,
	.remove		= tlan_remove_one,
	.driver.pm	= &tlan_pm_ops,
};

static int __init tlan_probe(void)
{
	int rc = -ENODEV;

	pr_info("%s", tlan_banner);

	TLAN_DBG(TLAN_DEBUG_PROBE, "Starting PCI Probe....\n");

	/* Use new style PCI probing. Now the kernel will
	   do most of this for us */
	rc = pci_register_driver(&tlan_driver);

	if (rc != 0) {
		pr_err("Could not register pci driver\n");
		goto err_out_pci_free;
	}

	TLAN_DBG(TLAN_DEBUG_PROBE, "Starting EISA Probe....\n");
	tlan_eisa_probe();

	pr_info("%d device%s installed, PCI: %d  EISA: %d\n",
		tlan_devices_installed, tlan_devices_installed == 1 ? "" : "s",
		tlan_have_pci, tlan_have_eisa);

	if (tlan_devices_installed == 0) {
		rc = -ENODEV;
		goto  err_out_pci_unreg;
	}
	return 0;

err_out_pci_unreg:
	pci_unregister_driver(&tlan_driver);
err_out_pci_free:
	return rc;
}


static int tlan_init_one(struct pci_dev *pdev,
				   const struct pci_device_id *ent)
{
	return tlan_probe1(pdev, -1, -1, 0, ent);
}


/*
***************************************************************
*	tlan_probe1
*
*	Returns:
*		0 on success, error code on error
*	Parms:
*		none
*
*	The name is lower case to fit in with all the rest of
*	the netcard_probe names.  This function looks for
*	another TLan based adapter, setting it up with the
*	allocated device struct if one is found.
*	tlan_probe has been ported to the new net API and
*	now allocates its own device structure. This function
*	is also used by modules.
*
**************************************************************/

static int tlan_probe1(struct pci_dev *pdev, long ioaddr, int irq, int rev,
		       const struct pci_device_id *ent)
{

	struct net_device  *dev;
	struct tlan_priv  *priv;
	u16		   device_id;
	int		   reg, rc = -ENODEV;

#ifdef CONFIG_PCI
	if (pdev) {
		rc = pci_enable_device(pdev);
		if (rc)
			return rc;

		rc = pci_request_regions(pdev, tlan_signature);
		if (rc) {
			pr_err("Could not reserve IO regions\n");
			goto err_out;

Annotation

Implementation Notes