summaryrefslogtreecommitdiffstats
path: root/drivers/char
diff options
context:
space:
mode:
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>2021-04-02 19:43:31 +0200
committerCorey Minyard <cminyard@mvista.com>2021-04-02 19:53:34 +0200
commit2dafddb8829fdc8969c2aad9fc6852419102d7fa (patch)
treea2274d96afc12aba97649e63b1ade919b7df633e /drivers/char
parentipmi_si: Reuse si_to_str[] array in ipmi_hardcode_init_one() (diff)
downloadlinux-2dafddb8829fdc8969c2aad9fc6852419102d7fa.tar.xz
linux-2dafddb8829fdc8969c2aad9fc6852419102d7fa.zip
ipmi_si: Get rid of ->addr_source_cleanup()
The ->addr_source_cleanup() callback is solely used by PCI driver and only for one purpose, i.e. to disable device. Get rid of ->addr_source_cleanup() by switching to PCI managed API. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Message-Id: <20210402174334.13466-8-andriy.shevchenko@linux.intel.com> Signed-off-by: Corey Minyard <cminyard@mvista.com>
Diffstat (limited to 'drivers/char')
-rw-r--r--drivers/char/ipmi/ipmi_si.h2
-rw-r--r--drivers/char/ipmi/ipmi_si_intf.c4
-rw-r--r--drivers/char/ipmi/ipmi_si_pci.c18
3 files changed, 2 insertions, 22 deletions
diff --git a/drivers/char/ipmi/ipmi_si.h b/drivers/char/ipmi/ipmi_si.h
index 9492c53eba86..0a4c69539f24 100644
--- a/drivers/char/ipmi/ipmi_si.h
+++ b/drivers/char/ipmi/ipmi_si.h
@@ -52,8 +52,6 @@ struct si_sm_io {
enum ipmi_addr_space addr_space;
unsigned long addr_data;
enum ipmi_addr_src addr_source; /* ACPI, PCI, SMBIOS, hardcode, etc. */
- void (*addr_source_cleanup)(struct si_sm_io *io);
- void *addr_source_data;
union ipmi_smi_info_union addr_info;
int (*io_setup)(struct si_sm_io *info);
diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c
index d6ecf88636c4..5bf0ab61261f 100644
--- a/drivers/char/ipmi/ipmi_si_intf.c
+++ b/drivers/char/ipmi/ipmi_si_intf.c
@@ -2206,10 +2206,6 @@ static void shutdown_smi(void *send_info)
if (smi_info->handlers)
smi_info->handlers->cleanup(smi_info->si_sm);
- if (smi_info->io.addr_source_cleanup) {
- smi_info->io.addr_source_cleanup(&smi_info->io);
- smi_info->io.addr_source_cleanup = NULL;
- }
if (smi_info->io.io_cleanup) {
smi_info->io.io_cleanup(&smi_info->io);
smi_info->io.io_cleanup = NULL;
diff --git a/drivers/char/ipmi/ipmi_si_pci.c b/drivers/char/ipmi/ipmi_si_pci.c
index 95bbcfba5408..0bc7efb6902c 100644
--- a/drivers/char/ipmi/ipmi_si_pci.c
+++ b/drivers/char/ipmi/ipmi_si_pci.c
@@ -21,13 +21,6 @@ MODULE_PARM_DESC(trypci, "Setting this to zero will disable the"
#define PCI_DEVICE_ID_HP_MMC 0x121A
-static void ipmi_pci_cleanup(struct si_sm_io *io)
-{
- struct pci_dev *pdev = io->addr_source_data;
-
- pci_disable_device(pdev);
-}
-
static int ipmi_pci_probe_regspacing(struct si_sm_io *io)
{
if (io->si_type == SI_KCS) {
@@ -97,15 +90,12 @@ static int ipmi_pci_probe(struct pci_dev *pdev,
return -ENOMEM;
}
- rv = pci_enable_device(pdev);
+ rv = pcim_enable_device(pdev);
if (rv) {
dev_err(&pdev->dev, "couldn't enable PCI device\n");
return rv;
}
- io.addr_source_cleanup = ipmi_pci_cleanup;
- io.addr_source_data = pdev;
-
if (pci_resource_flags(pdev, 0) & IORESOURCE_IO) {
io.addr_space = IPMI_IO_ADDR_SPACE;
io.io_setup = ipmi_si_port_setup;
@@ -128,11 +118,7 @@ static int ipmi_pci_probe(struct pci_dev *pdev,
dev_info(&pdev->dev, "%pR regsize %d spacing %d irq %d\n",
&pdev->resource[0], io.regsize, io.regspacing, io.irq);
- rv = ipmi_si_add_smi(&io);
- if (rv)
- pci_disable_device(pdev);
-
- return rv;
+ return ipmi_si_add_smi(&io);
}
static void ipmi_pci_remove(struct pci_dev *pdev)