diff options
| author | Jeremy Sowden <[email protected]> | 2019-05-21 11:35:23 +0100 |
|---|---|---|
| committer | Greg Kroah-Hartman <[email protected]> | 2019-05-22 14:44:22 +0200 |
| commit | e416dad158f289ef2af48bf21fca53acc3935353 (patch) | |
| tree | e130ef86eb55c775b9d470485f0e23793b036c41 /tools/perf/scripts/python/export-to-postgresql.py | |
| parent | f731540813474de5d371d650ef00443aa7811b92 (diff) | |
staging: kpc2000: simplified kp2000_device retrieval in device attribute call-backs.
All the call-backs used the same formula to retrieve the pcard from dev:
struct pci_dev *pdev = to_pci_dev(dev);
struct kp2000_device *pcard;
if (!pdev)
return NULL;
pcard = pci_get_drvdata(pdev);
Since to_pci_dev is a wrapper for container_of, it will not return NULL,
and since pci_get_drvdata just calls dev_get_drvdata on the dev member
of pdev, this is equivalent to:
struct kp2000_device *pcard = dev_get_drvdata(&(container_of(dev, struct pci_dev, dev)->dev));
and we can simplify it to:
struct kp2000_device *pcard = dev_get_drvdata(dev);
Signed-off-by: Jeremy Sowden <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Diffstat (limited to 'tools/perf/scripts/python/export-to-postgresql.py')
0 files changed, 0 insertions, 0 deletions