ipmi: Mostly updates for deprecated interfaces

These changes are mostly updates for deprecated interfaces,
 platform.remove and converting from a tasklet to a BH workqueue.  Also
 use HAS_IOPORT for disabling inb()/outb().
 
 -corey
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEE/Q1c5nzg9ZpmiCaGYfOMkJGb/4EFAmZCYRMACgkQYfOMkJGb
 /4FqGBAAq2KsgdpCSquJMl8uvlxXzxpZJsUpZBMPeZyI9kJUPimNVvkd0iz2zx4C
 0yU9UxUcIViU1MuL8KyRhC/vpoDg3cZLspvkntWoU/qGcfQMsnxgbuogBKXTjRWt
 cOi/rFSBFXMv0gQ+aNWlFHVZdzQQ1vuiIIZNvIBNjvfaJargYXlUX91ejY/1DZHc
 Eeq0N7AiswPD0q1KZjJ5W2YYwqiNRubUbA2eq2mFvTbODi0JPgyNYI0qikMTFGM/
 L2vFRylqzMr63uFh5j+Dc1oJqdc+XtqOMIDd+34h+43td7XbBW+magdNBBLzMuYt
 HmrvBvlNH1zjXVEpAkqrOFnBYCisynKXvco7rhyTX1MaLuBo+pFNBzFlOw9s6Ydv
 +4VIBMcyz7ZVcOQgrZX5d5ly5Oh5wjAnIN3IPeDczaieMlfhk+e/MJBwDNT/7frD
 j7bnQ0tuzMvMhtZ/YfdzOZR/08cBMPRB2EJBGIQrTZeKJPcTLW73IkbQqQ6/8San
 dOgOqOGx/mAegf0vRp8ZPlyYAlSZ5l5cANRyWZjG8+EkajFB26iJmXY0jyf1yZ+I
 Vzb79YqmtB2eu/fFuJ5suF4UkvI8RLFEJxnPRvBe+420rFHs4yHL5TzyzIOACL29
 OGAoatvC7qBWNYFWh8P3jFyxScVBC4lV1FYWwoCwOFevMz9kAXw=
 =IPex
 -----END PGP SIGNATURE-----

Merge tag 'for-linus-6.10-1' of https://github.com/cminyard/linux-ipmi

Pull ipmi updates from Corey Minyard:
 "Mostly updates for deprecated interfaces, platform.remove and
  converting from a tasklet to a BH workqueue.

  Also use HAS_IOPORT for disabling inb()/outb()"

* tag 'for-linus-6.10-1' of https://github.com/cminyard/linux-ipmi:
  ipmi: kcs_bmc_npcm7xx: Convert to platform remove callback returning void
  ipmi: kcs_bmc_aspeed: Convert to platform remove callback returning void
  ipmi: ipmi_ssif: Convert to platform remove callback returning void
  ipmi: ipmi_si_platform: Convert to platform remove callback returning void
  ipmi: ipmi_powernv: Convert to platform remove callback returning void
  ipmi: bt-bmc: Convert to platform remove callback returning void
  char: ipmi: handle HAS_IOPORT dependencies
  ipmi: Convert from tasklet to BH workqueue
This commit is contained in:
Linus Torvalds 2024-05-25 14:32:29 -07:00
commit 56676c4c06
10 changed files with 35 additions and 45 deletions

View File

@ -5,13 +5,10 @@
ipmi_si-y := ipmi_si_intf.o ipmi_kcs_sm.o ipmi_smic_sm.o ipmi_bt_sm.o \ ipmi_si-y := ipmi_si_intf.o ipmi_kcs_sm.o ipmi_smic_sm.o ipmi_bt_sm.o \
ipmi_si_hotmod.o ipmi_si_hardcode.o ipmi_si_platform.o \ ipmi_si_hotmod.o ipmi_si_hardcode.o ipmi_si_platform.o \
ipmi_si_port_io.o ipmi_si_mem_io.o ipmi_si_mem_io.o
ifdef CONFIG_PCI ipmi_si-$(CONFIG_HAS_IOPORT) += ipmi_si_port_io.o
ipmi_si-y += ipmi_si_pci.o ipmi_si-$(CONFIG_PCI) += ipmi_si_pci.o
endif ipmi_si-$(CONFIG_PARISC) += ipmi_si_parisc.o
ifdef CONFIG_PARISC
ipmi_si-y += ipmi_si_parisc.o
endif
obj-$(CONFIG_IPMI_HANDLER) += ipmi_msghandler.o obj-$(CONFIG_IPMI_HANDLER) += ipmi_msghandler.o
obj-$(CONFIG_IPMI_DEVICE_INTERFACE) += ipmi_devintf.o obj-$(CONFIG_IPMI_DEVICE_INTERFACE) += ipmi_devintf.o

View File

@ -459,14 +459,13 @@ static int bt_bmc_probe(struct platform_device *pdev)
return 0; return 0;
} }
static int bt_bmc_remove(struct platform_device *pdev) static void bt_bmc_remove(struct platform_device *pdev)
{ {
struct bt_bmc *bt_bmc = dev_get_drvdata(&pdev->dev); struct bt_bmc *bt_bmc = dev_get_drvdata(&pdev->dev);
misc_deregister(&bt_bmc->miscdev); misc_deregister(&bt_bmc->miscdev);
if (bt_bmc->irq < 0) if (bt_bmc->irq < 0)
del_timer_sync(&bt_bmc->poll_timer); del_timer_sync(&bt_bmc->poll_timer);
return 0;
} }
static const struct of_device_id bt_bmc_match[] = { static const struct of_device_id bt_bmc_match[] = {
@ -482,7 +481,7 @@ static struct platform_driver bt_bmc_driver = {
.of_match_table = bt_bmc_match, .of_match_table = bt_bmc_match,
}, },
.probe = bt_bmc_probe, .probe = bt_bmc_probe,
.remove = bt_bmc_remove, .remove_new = bt_bmc_remove,
}; };
module_platform_driver(bt_bmc_driver); module_platform_driver(bt_bmc_driver);

View File

@ -41,7 +41,7 @@
static struct ipmi_recv_msg *ipmi_alloc_recv_msg(void); static struct ipmi_recv_msg *ipmi_alloc_recv_msg(void);
static int ipmi_init_msghandler(void); static int ipmi_init_msghandler(void);
static void smi_recv_tasklet(struct tasklet_struct *t); static void smi_recv_work(struct work_struct *t);
static void handle_new_recv_msgs(struct ipmi_smi *intf); static void handle_new_recv_msgs(struct ipmi_smi *intf);
static void need_waiter(struct ipmi_smi *intf); static void need_waiter(struct ipmi_smi *intf);
static int handle_one_recv_msg(struct ipmi_smi *intf, static int handle_one_recv_msg(struct ipmi_smi *intf,
@ -498,13 +498,13 @@ struct ipmi_smi {
/* /*
* Messages queued for delivery. If delivery fails (out of memory * Messages queued for delivery. If delivery fails (out of memory
* for instance), They will stay in here to be processed later in a * for instance), They will stay in here to be processed later in a
* periodic timer interrupt. The tasklet is for handling received * periodic timer interrupt. The workqueue is for handling received
* messages directly from the handler. * messages directly from the handler.
*/ */
spinlock_t waiting_rcv_msgs_lock; spinlock_t waiting_rcv_msgs_lock;
struct list_head waiting_rcv_msgs; struct list_head waiting_rcv_msgs;
atomic_t watchdog_pretimeouts_to_deliver; atomic_t watchdog_pretimeouts_to_deliver;
struct tasklet_struct recv_tasklet; struct work_struct recv_work;
spinlock_t xmit_msgs_lock; spinlock_t xmit_msgs_lock;
struct list_head xmit_msgs; struct list_head xmit_msgs;
@ -704,7 +704,7 @@ static void clean_up_interface_data(struct ipmi_smi *intf)
struct cmd_rcvr *rcvr, *rcvr2; struct cmd_rcvr *rcvr, *rcvr2;
struct list_head list; struct list_head list;
tasklet_kill(&intf->recv_tasklet); cancel_work_sync(&intf->recv_work);
free_smi_msg_list(&intf->waiting_rcv_msgs); free_smi_msg_list(&intf->waiting_rcv_msgs);
free_recv_msg_list(&intf->waiting_events); free_recv_msg_list(&intf->waiting_events);
@ -1319,7 +1319,7 @@ static void free_user(struct kref *ref)
{ {
struct ipmi_user *user = container_of(ref, struct ipmi_user, refcount); struct ipmi_user *user = container_of(ref, struct ipmi_user, refcount);
/* SRCU cleanup must happen in task context. */ /* SRCU cleanup must happen in workqueue context. */
queue_work(remove_work_wq, &user->remove_work); queue_work(remove_work_wq, &user->remove_work);
} }
@ -3605,8 +3605,7 @@ int ipmi_add_smi(struct module *owner,
intf->curr_seq = 0; intf->curr_seq = 0;
spin_lock_init(&intf->waiting_rcv_msgs_lock); spin_lock_init(&intf->waiting_rcv_msgs_lock);
INIT_LIST_HEAD(&intf->waiting_rcv_msgs); INIT_LIST_HEAD(&intf->waiting_rcv_msgs);
tasklet_setup(&intf->recv_tasklet, INIT_WORK(&intf->recv_work, smi_recv_work);
smi_recv_tasklet);
atomic_set(&intf->watchdog_pretimeouts_to_deliver, 0); atomic_set(&intf->watchdog_pretimeouts_to_deliver, 0);
spin_lock_init(&intf->xmit_msgs_lock); spin_lock_init(&intf->xmit_msgs_lock);
INIT_LIST_HEAD(&intf->xmit_msgs); INIT_LIST_HEAD(&intf->xmit_msgs);
@ -4779,7 +4778,7 @@ static void handle_new_recv_msgs(struct ipmi_smi *intf)
* To preserve message order, quit if we * To preserve message order, quit if we
* can't handle a message. Add the message * can't handle a message. Add the message
* back at the head, this is safe because this * back at the head, this is safe because this
* tasklet is the only thing that pulls the * workqueue is the only thing that pulls the
* messages. * messages.
*/ */
list_add(&smi_msg->link, &intf->waiting_rcv_msgs); list_add(&smi_msg->link, &intf->waiting_rcv_msgs);
@ -4812,10 +4811,10 @@ static void handle_new_recv_msgs(struct ipmi_smi *intf)
} }
} }
static void smi_recv_tasklet(struct tasklet_struct *t) static void smi_recv_work(struct work_struct *t)
{ {
unsigned long flags = 0; /* keep us warning-free. */ unsigned long flags = 0; /* keep us warning-free. */
struct ipmi_smi *intf = from_tasklet(intf, t, recv_tasklet); struct ipmi_smi *intf = from_work(intf, t, recv_work);
int run_to_completion = intf->run_to_completion; int run_to_completion = intf->run_to_completion;
struct ipmi_smi_msg *newmsg = NULL; struct ipmi_smi_msg *newmsg = NULL;
@ -4866,7 +4865,7 @@ void ipmi_smi_msg_received(struct ipmi_smi *intf,
/* /*
* To preserve message order, we keep a queue and deliver from * To preserve message order, we keep a queue and deliver from
* a tasklet. * a workqueue.
*/ */
if (!run_to_completion) if (!run_to_completion)
spin_lock_irqsave(&intf->waiting_rcv_msgs_lock, flags); spin_lock_irqsave(&intf->waiting_rcv_msgs_lock, flags);
@ -4887,9 +4886,9 @@ void ipmi_smi_msg_received(struct ipmi_smi *intf,
spin_unlock_irqrestore(&intf->xmit_msgs_lock, flags); spin_unlock_irqrestore(&intf->xmit_msgs_lock, flags);
if (run_to_completion) if (run_to_completion)
smi_recv_tasklet(&intf->recv_tasklet); smi_recv_work(&intf->recv_work);
else else
tasklet_schedule(&intf->recv_tasklet); queue_work(system_bh_wq, &intf->recv_work);
} }
EXPORT_SYMBOL(ipmi_smi_msg_received); EXPORT_SYMBOL(ipmi_smi_msg_received);
@ -4899,7 +4898,7 @@ void ipmi_smi_watchdog_pretimeout(struct ipmi_smi *intf)
return; return;
atomic_set(&intf->watchdog_pretimeouts_to_deliver, 1); atomic_set(&intf->watchdog_pretimeouts_to_deliver, 1);
tasklet_schedule(&intf->recv_tasklet); queue_work(system_bh_wq, &intf->recv_work);
} }
EXPORT_SYMBOL(ipmi_smi_watchdog_pretimeout); EXPORT_SYMBOL(ipmi_smi_watchdog_pretimeout);
@ -5068,7 +5067,7 @@ static bool ipmi_timeout_handler(struct ipmi_smi *intf,
flags); flags);
} }
tasklet_schedule(&intf->recv_tasklet); queue_work(system_bh_wq, &intf->recv_work);
return need_timer; return need_timer;
} }

View File

@ -281,15 +281,13 @@ err_free:
return rc; return rc;
} }
static int ipmi_powernv_remove(struct platform_device *pdev) static void ipmi_powernv_remove(struct platform_device *pdev)
{ {
struct ipmi_smi_powernv *smi = dev_get_drvdata(&pdev->dev); struct ipmi_smi_powernv *smi = dev_get_drvdata(&pdev->dev);
ipmi_unregister_smi(smi->intf); ipmi_unregister_smi(smi->intf);
free_irq(smi->irq, smi); free_irq(smi->irq, smi);
irq_dispose_mapping(smi->irq); irq_dispose_mapping(smi->irq);
return 0;
} }
static const struct of_device_id ipmi_powernv_match[] = { static const struct of_device_id ipmi_powernv_match[] = {
@ -304,7 +302,7 @@ static struct platform_driver powernv_ipmi_driver = {
.of_match_table = ipmi_powernv_match, .of_match_table = ipmi_powernv_match,
}, },
.probe = ipmi_powernv_probe, .probe = ipmi_powernv_probe,
.remove = ipmi_powernv_remove, .remove_new = ipmi_powernv_remove,
}; };

View File

@ -1882,7 +1882,8 @@ int ipmi_si_add_smi(struct si_sm_io *io)
} }
if (!io->io_setup) { if (!io->io_setup) {
if (io->addr_space == IPMI_IO_ADDR_SPACE) { if (IS_ENABLED(CONFIG_HAS_IOPORT) &&
io->addr_space == IPMI_IO_ADDR_SPACE) {
io->io_setup = ipmi_si_port_setup; io->io_setup = ipmi_si_port_setup;
} else if (io->addr_space == IPMI_MEM_ADDR_SPACE) { } else if (io->addr_space == IPMI_MEM_ADDR_SPACE) {
io->io_setup = ipmi_si_mem_setup; io->io_setup = ipmi_si_mem_setup;

View File

@ -97,6 +97,9 @@ static int ipmi_pci_probe(struct pci_dev *pdev,
} }
if (pci_resource_flags(pdev, 0) & IORESOURCE_IO) { if (pci_resource_flags(pdev, 0) & IORESOURCE_IO) {
if (!IS_ENABLED(CONFIG_HAS_IOPORT))
return -ENXIO;
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;
} else { } else {

View File

@ -405,11 +405,9 @@ static int ipmi_probe(struct platform_device *pdev)
return platform_ipmi_probe(pdev); return platform_ipmi_probe(pdev);
} }
static int ipmi_remove(struct platform_device *pdev) static void ipmi_remove(struct platform_device *pdev)
{ {
ipmi_si_remove_by_dev(&pdev->dev); ipmi_si_remove_by_dev(&pdev->dev);
return 0;
} }
static int pdev_match_name(struct device *dev, const void *data) static int pdev_match_name(struct device *dev, const void *data)
@ -447,7 +445,7 @@ struct platform_driver ipmi_platform_driver = {
.acpi_match_table = ACPI_PTR(acpi_ipmi_match), .acpi_match_table = ACPI_PTR(acpi_ipmi_match),
}, },
.probe = ipmi_probe, .probe = ipmi_probe,
.remove = ipmi_remove, .remove_new = ipmi_remove,
.id_table = si_plat_ids .id_table = si_plat_ids
}; };

View File

@ -2071,7 +2071,7 @@ static int ssif_platform_probe(struct platform_device *dev)
return dmi_ipmi_probe(dev); return dmi_ipmi_probe(dev);
} }
static int ssif_platform_remove(struct platform_device *dev) static void ssif_platform_remove(struct platform_device *dev)
{ {
struct ssif_addr_info *addr_info = dev_get_drvdata(&dev->dev); struct ssif_addr_info *addr_info = dev_get_drvdata(&dev->dev);
@ -2079,7 +2079,6 @@ static int ssif_platform_remove(struct platform_device *dev)
list_del(&addr_info->link); list_del(&addr_info->link);
kfree(addr_info); kfree(addr_info);
mutex_unlock(&ssif_infos_mutex); mutex_unlock(&ssif_infos_mutex);
return 0;
} }
static const struct platform_device_id ssif_plat_ids[] = { static const struct platform_device_id ssif_plat_ids[] = {
@ -2092,7 +2091,7 @@ static struct platform_driver ipmi_driver = {
.name = DEVICE_NAME, .name = DEVICE_NAME,
}, },
.probe = ssif_platform_probe, .probe = ssif_platform_probe,
.remove = ssif_platform_remove, .remove_new = ssif_platform_remove,
.id_table = ssif_plat_ids .id_table = ssif_plat_ids
}; };

View File

@ -641,7 +641,7 @@ static int aspeed_kcs_probe(struct platform_device *pdev)
return 0; return 0;
} }
static int aspeed_kcs_remove(struct platform_device *pdev) static void aspeed_kcs_remove(struct platform_device *pdev)
{ {
struct aspeed_kcs_bmc *priv = platform_get_drvdata(pdev); struct aspeed_kcs_bmc *priv = platform_get_drvdata(pdev);
struct kcs_bmc_device *kcs_bmc = &priv->kcs_bmc; struct kcs_bmc_device *kcs_bmc = &priv->kcs_bmc;
@ -656,8 +656,6 @@ static int aspeed_kcs_remove(struct platform_device *pdev)
priv->obe.remove = true; priv->obe.remove = true;
spin_unlock_irq(&priv->obe.lock); spin_unlock_irq(&priv->obe.lock);
del_timer_sync(&priv->obe.timer); del_timer_sync(&priv->obe.timer);
return 0;
} }
static const struct of_device_id ast_kcs_bmc_match[] = { static const struct of_device_id ast_kcs_bmc_match[] = {
@ -674,7 +672,7 @@ static struct platform_driver ast_kcs_bmc_driver = {
.of_match_table = ast_kcs_bmc_match, .of_match_table = ast_kcs_bmc_match,
}, },
.probe = aspeed_kcs_probe, .probe = aspeed_kcs_probe,
.remove = aspeed_kcs_remove, .remove_new = aspeed_kcs_remove,
}; };
module_platform_driver(ast_kcs_bmc_driver); module_platform_driver(ast_kcs_bmc_driver);

View File

@ -218,7 +218,7 @@ static int npcm7xx_kcs_probe(struct platform_device *pdev)
return 0; return 0;
} }
static int npcm7xx_kcs_remove(struct platform_device *pdev) static void npcm7xx_kcs_remove(struct platform_device *pdev)
{ {
struct npcm7xx_kcs_bmc *priv = platform_get_drvdata(pdev); struct npcm7xx_kcs_bmc *priv = platform_get_drvdata(pdev);
struct kcs_bmc_device *kcs_bmc = &priv->kcs_bmc; struct kcs_bmc_device *kcs_bmc = &priv->kcs_bmc;
@ -227,8 +227,6 @@ static int npcm7xx_kcs_remove(struct platform_device *pdev)
npcm7xx_kcs_enable_channel(kcs_bmc, false); npcm7xx_kcs_enable_channel(kcs_bmc, false);
npcm7xx_kcs_irq_mask_update(kcs_bmc, (KCS_BMC_EVENT_TYPE_IBF | KCS_BMC_EVENT_TYPE_OBE), 0); npcm7xx_kcs_irq_mask_update(kcs_bmc, (KCS_BMC_EVENT_TYPE_IBF | KCS_BMC_EVENT_TYPE_OBE), 0);
return 0;
} }
static const struct of_device_id npcm_kcs_bmc_match[] = { static const struct of_device_id npcm_kcs_bmc_match[] = {
@ -243,7 +241,7 @@ static struct platform_driver npcm_kcs_bmc_driver = {
.of_match_table = npcm_kcs_bmc_match, .of_match_table = npcm_kcs_bmc_match,
}, },
.probe = npcm7xx_kcs_probe, .probe = npcm7xx_kcs_probe,
.remove = npcm7xx_kcs_remove, .remove_new = npcm7xx_kcs_remove,
}; };
module_platform_driver(npcm_kcs_bmc_driver); module_platform_driver(npcm_kcs_bmc_driver);