From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: "Winkler, Tomas" <tomas.winkler@intel.com>,
Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
"Usyskin, Alexander" <alexander.usyskin@intel.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [char-misc-next] mei: simplify error handling via devres function.
Date: Mon, 23 Jan 2017 16:48:53 +0200 [thread overview]
Message-ID: <1485182933.2133.285.camel@linux.intel.com> (raw)
In-Reply-To: <5B8DA87D05A7694D9FA63FD143655C1B543802E4@hasmsx108.ger.corp.intel.com>
On Sat, 2017-01-21 at 10:12 +0000, Winkler, Tomas wrote:
> >
> > > -struct mei_device *mei_txe_dev_init(struct pci_dev *pdev)
> > > +struct mei_device *devm_mei_txe_init(struct pci_dev *pdev)
> >
> > Ditto.
> >
> > > end:
> > > + pci_set_drvdata(pdev, NULL);
> >
> > Not needed.
>
> Please explain, we rely on pci_get_drvdata() returning NULL when
> unregistered.
PCI core will take care about this one. Actually device core for any of
user of struct device.
See __device_release_driver() for the details.
> >
> > > - free_irq(pdev->irq, dev);
> > > + devm_free_irq(&pdev->dev, pdev->irq, dev);
> > > pci_disable_msi(pdev);
> >
> > All three not needed
>
> I believe we need it on suspend as we are going over irq request
> again in resume. Please provide more info you if you still insist.
Ah, sorry, I missed that these are suspend/resume hooks.
So, Can you elaborate a bit why you need to disable interrupts during
system suspend?
(Basically in this case better not to use devm_request_*irq() at all)
> >
> > > return 0;
> > > @@ -75,22 +64,22 @@ static int mei_txe_probe(struct pci_dev *pdev,
> > > const struct pci_device_id *ent) {
> > > struct mei_device *dev;
> > > struct mei_txe_hw *hw;
> > > + const int mask = BIT(SEC_BAR) | BIT(BRIDGE_BAR);
> >
> > First line?
>
> Please be more verbose.
Use reversed tree for definition block.
The longest lines with the assignment = first;
Then lines without assignment;
Then return code variable;
Flags for spin_lock -- depends.
> >
> > > + memcpy(hw->mem_addr, pcim_iomap_table(pdev),
> > > + sizeof(hw->mem_addr));
> >
> > Why?
> > It is kept by PCI core, you don't need a copy.
>
> There is no simple accessor for that, it's easier to copy the two
> dwords then going over the function calls.
I'm not sure you need a copy. That function call just return the pointer
to the table.
I remember 8250_pci used to have similar approach, now it's using
whatever is kept by PCI core.
It's less error prone.
> > > @@ -256,7 +210,7 @@ static int mei_txe_pci_suspend(struct device
> > > *device)
> > > - free_irq(pdev->irq, dev);
> > > + devm_free_irq(&pdev->dev, pdev->irq, dev);
> > > pci_disable_msi(pdev);
> >
> > All are redundant.
Yeah, same clarification as for above case with system sleep.
--
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Intel Finland Oy
next prev parent reply other threads:[~2017-01-23 14:49 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-20 17:22 [char-misc-next] mei: simplify error handling via devres function Tomas Winkler
2017-01-20 16:33 ` Andy Shevchenko
2017-01-20 22:00 ` Andy Shevchenko
2017-01-21 10:12 ` Winkler, Tomas
2017-01-23 14:48 ` Andy Shevchenko [this message]
2017-01-23 22:33 ` Winkler, Tomas
2017-01-23 22:40 ` Andy Shevchenko
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=1485182933.2133.285.camel@linux.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=alexander.usyskin@intel.com \
--cc=andy.shevchenko@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tomas.winkler@intel.com \
/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;
as well as URLs for NNTP newsgroup(s).