Re: [PATCH v3 3/6] staging: kpc2000: simplified kp2000_device retrieval in device attributes call-backs.

2019-05-22 Thread Greg KH
On Tue, May 21, 2019 at 02:23:13PM +0300, Dan Carpenter wrote: > On Fri, May 17, 2019 at 01:54:51PM +0200, Greg KH wrote: > > On Fri, May 17, 2019 at 12:03:12PM +0100, Jeremy Sowden wrote: > > > static ssize_t show_attr(struct device *dev, struct device_attribute > > > *attr, char *buf) > > >

Re: [PATCH v3 3/6] staging: kpc2000: simplified kp2000_device retrieval in device attributes call-backs.

2019-05-21 Thread Dan Carpenter
On Fri, May 17, 2019 at 01:54:51PM +0200, Greg KH wrote: > On Fri, May 17, 2019 at 12:03:12PM +0100, Jeremy Sowden wrote: > > static ssize_t show_attr(struct device *dev, struct device_attribute > > *attr, char *buf) > > { > > -struct pci_dev *pdev = to_pci_dev(dev); > > -struct

Re: [PATCH v3 3/6] staging: kpc2000: simplified kp2000_device retrieval in device attributes call-backs.

2019-05-17 Thread Jeremy Sowden
On 2019-05-17, at 13:54:51 +0200, Greg KH wrote: > On Fri, May 17, 2019 at 12:03:12PM +0100, Jeremy Sowden wrote: > > The call-backs used the same recipe to get the pcard from dev: > > > > struct pci_dev *pdev = to_pci_dev(dev); > > struct kp2000_device *pcard; > > > > if (!pdev) return

Re: [PATCH v3 3/6] staging: kpc2000: simplified kp2000_device retrieval in device attributes call-backs.

2019-05-17 Thread Greg KH
On Fri, May 17, 2019 at 12:03:12PM +0100, Jeremy Sowden wrote: > The call-backs used the same recipe 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

[PATCH v3 3/6] staging: kpc2000: simplified kp2000_device retrieval in device attributes call-backs.

2019-05-17 Thread Jeremy Sowden
The call-backs used the same recipe 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; where to_pci_dev is a wrapper for container_of. However,