mirror of
https://github.com/FEX-Emu/linux.git
synced 2024-12-21 08:53:41 +00:00
pciehp: update workqueue usage
* Rename pciehp_wq to pciehp_ordered_wq and add non-ordered pciehp_wq which is used instead of the system workqueue. This is to remove the use of flush_scheduled_work() which is deprecated and scheduled for removal. * With cmwq in place, there's no point in creating workqueues lazily. Create both pciehp_wq and pciehp_ordered_wq upfront. * Include workqueue.h from pciehp.h. Signed-off-by: Tejun Heo <tj@kernel.org> Acked-by: Jesse Barnes <jbarnes@virtuousgeek.org>
This commit is contained in:
parent
7bf4a5ddc9
commit
a827ea307b
@ -36,6 +36,7 @@
|
|||||||
#include <linux/sched.h> /* signal_pending() */
|
#include <linux/sched.h> /* signal_pending() */
|
||||||
#include <linux/pcieport_if.h>
|
#include <linux/pcieport_if.h>
|
||||||
#include <linux/mutex.h>
|
#include <linux/mutex.h>
|
||||||
|
#include <linux/workqueue.h>
|
||||||
|
|
||||||
#define MY_NAME "pciehp"
|
#define MY_NAME "pciehp"
|
||||||
|
|
||||||
@ -44,6 +45,7 @@ extern int pciehp_poll_time;
|
|||||||
extern int pciehp_debug;
|
extern int pciehp_debug;
|
||||||
extern int pciehp_force;
|
extern int pciehp_force;
|
||||||
extern struct workqueue_struct *pciehp_wq;
|
extern struct workqueue_struct *pciehp_wq;
|
||||||
|
extern struct workqueue_struct *pciehp_ordered_wq;
|
||||||
|
|
||||||
#define dbg(format, arg...) \
|
#define dbg(format, arg...) \
|
||||||
do { \
|
do { \
|
||||||
|
@ -43,6 +43,7 @@ int pciehp_poll_mode;
|
|||||||
int pciehp_poll_time;
|
int pciehp_poll_time;
|
||||||
int pciehp_force;
|
int pciehp_force;
|
||||||
struct workqueue_struct *pciehp_wq;
|
struct workqueue_struct *pciehp_wq;
|
||||||
|
struct workqueue_struct *pciehp_ordered_wq;
|
||||||
|
|
||||||
#define DRIVER_VERSION "0.4"
|
#define DRIVER_VERSION "0.4"
|
||||||
#define DRIVER_AUTHOR "Dan Zink <dan.zink@compaq.com>, Greg Kroah-Hartman <greg@kroah.com>, Dely Sy <dely.l.sy@intel.com>"
|
#define DRIVER_AUTHOR "Dan Zink <dan.zink@compaq.com>, Greg Kroah-Hartman <greg@kroah.com>, Dely Sy <dely.l.sy@intel.com>"
|
||||||
@ -340,18 +341,33 @@ static int __init pcied_init(void)
|
|||||||
{
|
{
|
||||||
int retval = 0;
|
int retval = 0;
|
||||||
|
|
||||||
|
pciehp_wq = alloc_workqueue("pciehp", 0, 0);
|
||||||
|
if (!pciehp_wq)
|
||||||
|
return -ENOMEM;
|
||||||
|
|
||||||
|
pciehp_ordered_wq = alloc_ordered_workqueue("pciehp_ordered", 0);
|
||||||
|
if (!pciehp_ordered_wq) {
|
||||||
|
destroy_workqueue(pciehp_wq);
|
||||||
|
return -ENOMEM;
|
||||||
|
}
|
||||||
|
|
||||||
pciehp_firmware_init();
|
pciehp_firmware_init();
|
||||||
retval = pcie_port_service_register(&hpdriver_portdrv);
|
retval = pcie_port_service_register(&hpdriver_portdrv);
|
||||||
dbg("pcie_port_service_register = %d\n", retval);
|
dbg("pcie_port_service_register = %d\n", retval);
|
||||||
info(DRIVER_DESC " version: " DRIVER_VERSION "\n");
|
info(DRIVER_DESC " version: " DRIVER_VERSION "\n");
|
||||||
if (retval)
|
if (retval) {
|
||||||
|
destroy_workqueue(pciehp_ordered_wq);
|
||||||
|
destroy_workqueue(pciehp_wq);
|
||||||
dbg("Failure to register service\n");
|
dbg("Failure to register service\n");
|
||||||
|
}
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void __exit pcied_cleanup(void)
|
static void __exit pcied_cleanup(void)
|
||||||
{
|
{
|
||||||
dbg("unload_pciehpd()\n");
|
dbg("unload_pciehpd()\n");
|
||||||
|
destroy_workqueue(pciehp_ordered_wq);
|
||||||
|
destroy_workqueue(pciehp_wq);
|
||||||
pcie_port_service_unregister(&hpdriver_portdrv);
|
pcie_port_service_unregister(&hpdriver_portdrv);
|
||||||
info(DRIVER_DESC " version: " DRIVER_VERSION " unloaded\n");
|
info(DRIVER_DESC " version: " DRIVER_VERSION " unloaded\n");
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,6 @@
|
|||||||
#include <linux/types.h>
|
#include <linux/types.h>
|
||||||
#include <linux/slab.h>
|
#include <linux/slab.h>
|
||||||
#include <linux/pci.h>
|
#include <linux/pci.h>
|
||||||
#include <linux/workqueue.h>
|
|
||||||
#include "../pci.h"
|
#include "../pci.h"
|
||||||
#include "pciehp.h"
|
#include "pciehp.h"
|
||||||
|
|
||||||
@ -50,7 +49,7 @@ static int queue_interrupt_event(struct slot *p_slot, u32 event_type)
|
|||||||
info->p_slot = p_slot;
|
info->p_slot = p_slot;
|
||||||
INIT_WORK(&info->work, interrupt_event_handler);
|
INIT_WORK(&info->work, interrupt_event_handler);
|
||||||
|
|
||||||
schedule_work(&info->work);
|
queue_work(pciehp_wq, &info->work);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -345,7 +344,7 @@ void pciehp_queue_pushbutton_work(struct work_struct *work)
|
|||||||
kfree(info);
|
kfree(info);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
queue_work(pciehp_wq, &info->work);
|
queue_work(pciehp_ordered_wq, &info->work);
|
||||||
out:
|
out:
|
||||||
mutex_unlock(&p_slot->lock);
|
mutex_unlock(&p_slot->lock);
|
||||||
}
|
}
|
||||||
@ -378,7 +377,7 @@ static void handle_button_press_event(struct slot *p_slot)
|
|||||||
if (ATTN_LED(ctrl))
|
if (ATTN_LED(ctrl))
|
||||||
pciehp_set_attention_status(p_slot, 0);
|
pciehp_set_attention_status(p_slot, 0);
|
||||||
|
|
||||||
schedule_delayed_work(&p_slot->work, 5*HZ);
|
queue_delayed_work(pciehp_wq, &p_slot->work, 5*HZ);
|
||||||
break;
|
break;
|
||||||
case BLINKINGOFF_STATE:
|
case BLINKINGOFF_STATE:
|
||||||
case BLINKINGON_STATE:
|
case BLINKINGON_STATE:
|
||||||
@ -440,7 +439,7 @@ static void handle_surprise_event(struct slot *p_slot)
|
|||||||
else
|
else
|
||||||
p_slot->state = POWERON_STATE;
|
p_slot->state = POWERON_STATE;
|
||||||
|
|
||||||
queue_work(pciehp_wq, &info->work);
|
queue_work(pciehp_ordered_wq, &info->work);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void interrupt_event_handler(struct work_struct *work)
|
static void interrupt_event_handler(struct work_struct *work)
|
||||||
|
@ -41,8 +41,6 @@
|
|||||||
#include "../pci.h"
|
#include "../pci.h"
|
||||||
#include "pciehp.h"
|
#include "pciehp.h"
|
||||||
|
|
||||||
static atomic_t pciehp_num_controllers = ATOMIC_INIT(0);
|
|
||||||
|
|
||||||
static inline int pciehp_readw(struct controller *ctrl, int reg, u16 *value)
|
static inline int pciehp_readw(struct controller *ctrl, int reg, u16 *value)
|
||||||
{
|
{
|
||||||
struct pci_dev *dev = ctrl->pcie->port;
|
struct pci_dev *dev = ctrl->pcie->port;
|
||||||
@ -805,8 +803,8 @@ static void pcie_cleanup_slot(struct controller *ctrl)
|
|||||||
{
|
{
|
||||||
struct slot *slot = ctrl->slot;
|
struct slot *slot = ctrl->slot;
|
||||||
cancel_delayed_work(&slot->work);
|
cancel_delayed_work(&slot->work);
|
||||||
flush_scheduled_work();
|
|
||||||
flush_workqueue(pciehp_wq);
|
flush_workqueue(pciehp_wq);
|
||||||
|
flush_workqueue(pciehp_ordered_wq);
|
||||||
kfree(slot);
|
kfree(slot);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -912,16 +910,6 @@ struct controller *pcie_init(struct pcie_device *dev)
|
|||||||
/* Disable sotfware notification */
|
/* Disable sotfware notification */
|
||||||
pcie_disable_notification(ctrl);
|
pcie_disable_notification(ctrl);
|
||||||
|
|
||||||
/*
|
|
||||||
* If this is the first controller to be initialized,
|
|
||||||
* initialize the pciehp work queue
|
|
||||||
*/
|
|
||||||
if (atomic_add_return(1, &pciehp_num_controllers) == 1) {
|
|
||||||
pciehp_wq = create_singlethread_workqueue("pciehpd");
|
|
||||||
if (!pciehp_wq)
|
|
||||||
goto abort_ctrl;
|
|
||||||
}
|
|
||||||
|
|
||||||
ctrl_info(ctrl, "HPC vendor_id %x device_id %x ss_vid %x ss_did %x\n",
|
ctrl_info(ctrl, "HPC vendor_id %x device_id %x ss_vid %x ss_did %x\n",
|
||||||
pdev->vendor, pdev->device, pdev->subsystem_vendor,
|
pdev->vendor, pdev->device, pdev->subsystem_vendor,
|
||||||
pdev->subsystem_device);
|
pdev->subsystem_device);
|
||||||
@ -941,11 +929,5 @@ void pciehp_release_ctrl(struct controller *ctrl)
|
|||||||
{
|
{
|
||||||
pcie_shutdown_notification(ctrl);
|
pcie_shutdown_notification(ctrl);
|
||||||
pcie_cleanup_slot(ctrl);
|
pcie_cleanup_slot(ctrl);
|
||||||
/*
|
|
||||||
* If this is the last controller to be released, destroy the
|
|
||||||
* pciehp work queue
|
|
||||||
*/
|
|
||||||
if (atomic_dec_and_test(&pciehp_num_controllers))
|
|
||||||
destroy_workqueue(pciehp_wq);
|
|
||||||
kfree(ctrl);
|
kfree(ctrl);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user