Commit 2dafddb8 authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Corey Minyard

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: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Message-Id: <20210402174334.13466-8-andriy.shevchenko@linux.intel.com>
Signed-off-by: default avatarCorey Minyard <cminyard@mvista.com>
parent 59cdb2e7
...@@ -52,8 +52,6 @@ struct si_sm_io { ...@@ -52,8 +52,6 @@ struct si_sm_io {
enum ipmi_addr_space addr_space; enum ipmi_addr_space addr_space;
unsigned long addr_data; unsigned long addr_data;
enum ipmi_addr_src addr_source; /* ACPI, PCI, SMBIOS, hardcode, etc. */ 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; union ipmi_smi_info_union addr_info;
int (*io_setup)(struct si_sm_io *info); int (*io_setup)(struct si_sm_io *info);
......
...@@ -2206,10 +2206,6 @@ static void shutdown_smi(void *send_info) ...@@ -2206,10 +2206,6 @@ static void shutdown_smi(void *send_info)
if (smi_info->handlers) if (smi_info->handlers)
smi_info->handlers->cleanup(smi_info->si_sm); 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) { if (smi_info->io.io_cleanup) {
smi_info->io.io_cleanup(&smi_info->io); smi_info->io.io_cleanup(&smi_info->io);
smi_info->io.io_cleanup = NULL; smi_info->io.io_cleanup = NULL;
......
...@@ -21,13 +21,6 @@ MODULE_PARM_DESC(trypci, "Setting this to zero will disable the" ...@@ -21,13 +21,6 @@ MODULE_PARM_DESC(trypci, "Setting this to zero will disable the"
#define PCI_DEVICE_ID_HP_MMC 0x121A #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) static int ipmi_pci_probe_regspacing(struct si_sm_io *io)
{ {
if (io->si_type == SI_KCS) { if (io->si_type == SI_KCS) {
...@@ -97,15 +90,12 @@ static int ipmi_pci_probe(struct pci_dev *pdev, ...@@ -97,15 +90,12 @@ static int ipmi_pci_probe(struct pci_dev *pdev,
return -ENOMEM; return -ENOMEM;
} }
rv = pci_enable_device(pdev); rv = pcim_enable_device(pdev);
if (rv) { if (rv) {
dev_err(&pdev->dev, "couldn't enable PCI device\n"); dev_err(&pdev->dev, "couldn't enable PCI device\n");
return rv; return rv;
} }
io.addr_source_cleanup = ipmi_pci_cleanup;
io.addr_source_data = pdev;
if (pci_resource_flags(pdev, 0) & IORESOURCE_IO) { if (pci_resource_flags(pdev, 0) & IORESOURCE_IO) {
io.addr_space = IPMI_IO_ADDR_SPACE; io.addr_space = IPMI_IO_ADDR_SPACE;
io.io_setup = ipmi_si_port_setup; io.io_setup = ipmi_si_port_setup;
...@@ -128,11 +118,7 @@ static int ipmi_pci_probe(struct pci_dev *pdev, ...@@ -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", dev_info(&pdev->dev, "%pR regsize %d spacing %d irq %d\n",
&pdev->resource[0], io.regsize, io.regspacing, io.irq); &pdev->resource[0], io.regsize, io.regspacing, io.irq);
rv = ipmi_si_add_smi(&io); return ipmi_si_add_smi(&io);
if (rv)
pci_disable_device(pdev);
return rv;
} }
static void ipmi_pci_remove(struct pci_dev *pdev) static void ipmi_pci_remove(struct pci_dev *pdev)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment