+Uwe Kleine-König On Mon, Jun 14, 2021 at 11:24 AM Jarkko Nikula <jarkko.nikula@xxxxxxxxxxxxxxx> wrote: > On 6/13/21 1:36 PM, Andy Shevchenko wrote: > > On Fri, Jun 11, 2021 at 2:57 PM Jarkko Nikula > > <jarkko.nikula@xxxxxxxxxxxxxxx> wrote: > >> > >> Use to_pci_dev() helper instead of container_of(d, struct pci_dev, dev); > > > > ... > > > >> - struct pci_dev *pdev = container_of(dev, struct pci_dev, dev); > >> + struct pci_dev *pdev = to_pci_dev(dev); > >> struct intel_qep *qep = pci_get_drvdata(pdev); > > > > Why not change both lines to dev_get_drvdata()? > > > I thought it before and Uwe had a good point why it isn't necessarily a > good idea: > > https://www.spinics.net/lists/linux-pwm/msg15325.html I understand this point, but the problem is that we often use different callbacks for different layers. For example, the PM callbacks are operating with generic 'struct device' and using the PCI device there is non-flexible layering violation, so in my opinion it's the opposite to what Uwe says. I.o.w. we need to use corresponding API to what we have in the callbacks. If the callback comes from generic level ==> generic APIs more appropriate. Anyway, it's such a minor detail, that I'm not going to insist on either way independently on the arguments. -- With Best Regards, Andy Shevchenko