]> git.baikalelectronics.ru Git - kernel.git/commit
staging: kpc2000: added a helper to get struct kp2000_device from struct device.
authorJeremy Sowden <jeremy@azazel.net>
Tue, 21 May 2019 10:35:20 +0000 (11:35 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 22 May 2019 12:44:21 +0000 (14:44 +0200)
commit82eb8f48b342e2974ca2b72cc57600fc0d07253b
tree4d439b5a9ee614a6247b9660a5ad39ff46050fe6
parent1dbf6f7e5faae8ac692a8d6d9d31e3de6bc6faf6
staging: kpc2000: added a helper to get struct kp2000_device from struct device.

The attribute call-backs all use the same formula to get the pcard from
dev:

  struct pci_dev *pdev = to_pci_dev(dev);
  struct kp2000_device *pcard;

  if (!pdev)
    return -ENXIO;
  pcard = pci_get_drvdata(pdev);
  if (!pcard)
    return -ENXIO;

Added a function to reduce the duplicated code.

Signed-off-by: Jeremy Sowden <jeremy@azazel.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/kpc2000/kpc2000/core.c