From: gregkh@linuxfoundation.org (Greg Kroah-Hartman)
Subject: [RFC 1/1] MicroSemi Switchtec management interface driver
Date: Mon, 19 Dec 2016 07:35:15 +0100 [thread overview]
Message-ID: <20161219063515.GA5814@kroah.com> (raw)
In-Reply-To: <d7c26e15-34f3-26d4-e13a-f24b4a9034c3@deltatee.com>
On Sun, Dec 18, 2016@10:20:47AM -0700, Logan Gunthorpe wrote:
> Hi Greg,
>
> Thanks for the quick review!
>
> On 18/12/16 12:51 AM, Greg Kroah-Hartman wrote:
> > On Sat, Dec 17, 2016@10:09:22AM -0700, Logan Gunthorpe wrote:
> > > +struct switchtec_dev {
> > > + struct pci_dev *pdev;
> > > + struct msix_entry *msix;
> > > + struct device *dev;
> > > + struct kref kref;
> >
> > Why do you have a pointer to a device, yet a kref as well? Just have
> > this structure embed a 'struct device' in itself, like you did for a
> > kref, and you will be fine. Otherwise you are dealing with two
> > different sets of reference counting here, for no good reason.
>
> Ok, understood. I had referenced the device dax driver which did it this way
> in 4.8 but looks like it was changed to the way you suggest in 4.9.
>
> > > +#define stdev_pdev(stdev) ((stdev)->pdev)
> > > +#define stdev_pdev_dev(stdev) (&stdev_pdev(stdev)->dev)
> > > +#define stdev_name(stdev) pci_name(stdev_pdev(stdev))
> > > +#define stdev_dev(stdev) ((stdev)->dev)
> >
> > Ick, just open code these please. That's a huge hint your use of the
> > driver model is not correct :)
>
> Ok, will do. For reference, I was copying
>
> drivers/ntb/hw/intel/ntb_hw_intel.h
>
> which does a similar thing.
No need to copy bad code, I suggest fixing that up as well :)
thanks,
greg k-h
next prev parent reply other threads:[~2016-12-19 6:35 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-17 17:09 [RFC 0/1] New PCI Switch Management Driver Logan Gunthorpe
2016-12-17 17:09 ` [RFC 1/1] MicroSemi Switchtec management interface driver Logan Gunthorpe
2016-12-18 7:51 ` Greg Kroah-Hartman
2016-12-18 17:20 ` Logan Gunthorpe
2016-12-19 6:35 ` Greg Kroah-Hartman [this message]
2016-12-19 17:02 ` Keith Busch
2016-12-19 17:07 ` Logan Gunthorpe
2016-12-19 16:09 ` [RFC 0/1] New PCI Switch Management Driver Myron Stowe
2016-12-19 17:06 ` Logan Gunthorpe
2016-12-19 17:29 ` Keith Busch
2016-12-19 17:26 ` Logan Gunthorpe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20161219063515.GA5814@kroah.com \
--to=gregkh@linuxfoundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox