Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1544104
| From | Greg Kroah-Hartman <gregkh@linuxfoundation.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [RFC 1/1] MicroSemi Switchtec management interface driver |
| Date | 2016-12-18 09:10 +0100 |
| Message-ID | <sPEHE-565-3@gated-at.bofh.it> (permalink) |
| References | <sPrhn-4eD-3@gated-at.bofh.it> <sPrhn-4eD-1@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Sat, Dec 17, 2016 at 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.
> +
> + unsigned int event_irq;
> +
> + void __iomem *mmio;
> + struct mrpc_regs __iomem *mmio_mrpc;
> + struct ntb_info_regs __iomem *mmio_ntb;
> + struct part_cfg_regs __iomem *mmio_part_cfg;
> +
> + /*
> + * The mrpc mutex must be held when accessing the other
> + * mrpc fields
> + */
> + struct mutex mrpc_mutex;
> + struct list_head mrpc_queue;
> + int mrpc_busy;
> + struct work_struct mrpc_work;
> + struct delayed_work mrpc_timeout;
> +};
> +
> +#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 :)
thanks,
greg k-h
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[RFC 1/1] MicroSemi Switchtec management interface driver Logan Gunthorpe <logang@deltatee.com> - 2016-12-17 18:50 +0100
Re: [RFC 1/1] MicroSemi Switchtec management interface driver Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-12-18 09:10 +0100
Re: [RFC 1/1] MicroSemi Switchtec management interface driver Logan Gunthorpe <logang@deltatee.com> - 2016-12-18 18:30 +0100
Re: [RFC 1/1] MicroSemi Switchtec management interface driver Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-12-19 07:40 +0100
Re: [RFC 1/1] MicroSemi Switchtec management interface driver Keith Busch <keith.busch@intel.com> - 2016-12-19 18:00 +0100
Re: [RFC 1/1] MicroSemi Switchtec management interface driver Logan Gunthorpe <logang@deltatee.com> - 2016-12-19 18:10 +0100
csiph-web