linux/drivers/net/wireless/atmel/atmel_pci.c
<<
>>
Prefs
   1// SPDX-License-Identifier: GPL-2.0-or-later
   2/*** -*- linux-c -*- **********************************************************
   3
   4     Driver for Atmel at76c502 at76c504 and at76c506 wireless cards.
   5
   6         Copyright 2004 Simon Kelley.
   7
   8
   9******************************************************************************/
  10#include <linux/pci.h>
  11#include <linux/kernel.h>
  12#include <linux/module.h>
  13#include <linux/netdevice.h>
  14#include "atmel.h"
  15
  16MODULE_AUTHOR("Simon Kelley");
  17MODULE_DESCRIPTION("Support for Atmel at76c50x 802.11 wireless ethernet cards.");
  18MODULE_LICENSE("GPL");
  19
  20static const struct pci_device_id card_ids[] = {
  21        { 0x1114, 0x0506, PCI_ANY_ID, PCI_ANY_ID },
  22        { 0, }
  23};
  24
  25MODULE_DEVICE_TABLE(pci, card_ids);
  26
  27static int atmel_pci_probe(struct pci_dev *, const struct pci_device_id *);
  28static void atmel_pci_remove(struct pci_dev *);
  29
  30static struct pci_driver atmel_driver = {
  31        .name     = "atmel",
  32        .id_table = card_ids,
  33        .probe    = atmel_pci_probe,
  34        .remove   = atmel_pci_remove,
  35};
  36
  37
  38static int atmel_pci_probe(struct pci_dev *pdev,
  39                                     const struct pci_device_id *pent)
  40{
  41        struct net_device *dev;
  42
  43        if (pci_enable_device(pdev))
  44                return -ENODEV;
  45
  46        pci_set_master(pdev);
  47
  48        dev = init_atmel_card(pdev->irq, pdev->resource[1].start,
  49                              ATMEL_FW_TYPE_506,
  50                              &pdev->dev, NULL, NULL);
  51        if (!dev) {
  52                pci_disable_device(pdev);
  53                return -ENODEV;
  54        }
  55
  56        pci_set_drvdata(pdev, dev);
  57        return 0;
  58}
  59
  60static void atmel_pci_remove(struct pci_dev *pdev)
  61{
  62        stop_atmel_card(pci_get_drvdata(pdev));
  63}
  64
  65module_pci_driver(atmel_driver);
  66