From: Salah Triki <salah.triki@gmail.com>
To: Ian Abbott <abbotti@mev.co.uk>,
H Hartley Sweeten <hsweeten@visionengravers.com>,
linux-kernel@vger.kernel.org
Cc: salah.triki@gmail.com
Subject: [PATCH] comedi: Use managed APIs
Date: Sat, 19 Jul 2025 16:42:50 +0100 [thread overview]
Message-ID: <aHu8-m5g9D-HvASk@pc> (raw)
Replace pci_enable_device() and pci_request_regions() with their
corresponding managed versions to simplify the code.
Signed-off-by: Salah Triki <salah.triki@gmail.com>
---
drivers/comedi/comedi_pci.c | 14 +++-----------
1 file changed, 3 insertions(+), 11 deletions(-)
diff --git a/drivers/comedi/comedi_pci.c b/drivers/comedi/comedi_pci.c
index cc2581902195..b8215320e1aa 100644
--- a/drivers/comedi/comedi_pci.c
+++ b/drivers/comedi/comedi_pci.c
@@ -53,14 +53,12 @@ int comedi_pci_enable(struct comedi_device *dev)
if (!pcidev)
return -ENODEV;
- rc = pci_enable_device(pcidev);
+ rc = pcim_enable_device(pcidev);
if (rc < 0)
return rc;
- rc = pci_request_regions(pcidev, dev->board_name);
- if (rc < 0)
- pci_disable_device(pcidev);
- else
+ rc = pcim_request_all_regions(pcidev, dev->board_name);
+ if (!rc)
dev->ioenabled = true;
return rc;
@@ -78,12 +76,6 @@ EXPORT_SYMBOL_GPL(comedi_pci_enable);
*/
void comedi_pci_disable(struct comedi_device *dev)
{
- struct pci_dev *pcidev = comedi_to_pci_dev(dev);
-
- if (pcidev && dev->ioenabled) {
- pci_release_regions(pcidev);
- pci_disable_device(pcidev);
- }
dev->ioenabled = false;
}
EXPORT_SYMBOL_GPL(comedi_pci_disable);
--
2.43.0
reply other threads:[~2025-07-19 15:42 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=aHu8-m5g9D-HvASk@pc \
--to=salah.triki@gmail.com \
--cc=abbotti@mev.co.uk \
--cc=hsweeten@visionengravers.com \
--cc=linux-kernel@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.