The patch titled Change return value from schedule_work() has been removed from the -mm tree. Its filename is change-return-value-from-schedule_work.patch This patch was dropped because it causes a warning storm - more thinking needed, I think ------------------------------------------------------ Subject: Change return value from schedule_work() From: Alan Stern <stern@xxxxxxxxxxxxxxxxxxx> This patch (as775) renames: schedule_work() to add_work(), schedule_delayed_work() to add_delayed_work(), schedule_delayed_work_on() to add_delayed_work_on(). The return value is altered, so that now 0 = success and -EBUSY = failure. New routines with the original names are added, so that the majority of callers don't need any changes. The new routines call the original functions, call WARN_ON if there was a failure, and then return void. schedule_console_callback() in drivers/char/vt.c required special alteration, because it normally called schedule_work() expecting the call to fail. Signed-off-by: Alan Stern <stern@xxxxxxxxxxxxxxxxxxx> Cc: Alessandro Zummo <a.zummo@xxxxxxxxxxxx> Cc: "Antonino A. Daplas" <adaplas@xxxxxxx> Cc: Jean Delvare <khali@xxxxxxxxxxxx> Cc: Dmitry Torokhov <dtor@xxxxxxx> Cc: Jeff Garzik <jeff@xxxxxxxxxx> Cc: Greg KH <greg@xxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxx> --- drivers/char/genrtc.c | 7 +-- drivers/char/vt.c | 8 +++- drivers/i2c/chips/isp1301_omap.c | 4 +- drivers/input/serio/libps2.c | 2 - drivers/net/smc911x.c | 3 - drivers/net/smc91x.c | 3 - drivers/rtc/rtc-dev.c | 6 +-- drivers/usb/gadget/ether.c | 2 - drivers/usb/input/hid-core.c | 2 - drivers/usb/net/usbnet.c | 2 - fs/file.c | 4 +- include/linux/workqueue.h | 14 ++++++- kernel/workqueue.c | 53 ++++++++++++++++++++++------- 13 files changed, 74 insertions(+), 36 deletions(-) diff -puN drivers/char/genrtc.c~change-return-value-from-schedule_work drivers/char/genrtc.c --- a/drivers/char/genrtc.c~change-return-value-from-schedule_work +++ a/drivers/char/genrtc.c @@ -122,7 +122,7 @@ static void genrtc_troutine(void *data) add_timer(&timer_task); gen_rtc_interrupt(0); - } else if (schedule_work(&genrtc_task) == 0) + } else if (add_work(&genrtc_task) < 0) stask_active = 0; } @@ -136,7 +136,7 @@ static void gen_rtc_timer(unsigned long jiffies-tt_exp); ttask_active=0; stask_active=1; - if ((schedule_work(&genrtc_task) == 0)) + if (add_work(&genrtc_task) < 0) stask_active = 0; } @@ -260,9 +260,8 @@ static inline int gen_set_rtc_irq_bit(un init_timer(&timer_task); stask_active = 1; - if (schedule_work(&genrtc_task) == 0){ + if (add_work(&genrtc_task) < 0) stask_active = 0; - } } spin_unlock(&gen_rtc_lock); gen_rtc_irq_data = 0; diff -puN drivers/char/vt.c~change-return-value-from-schedule_work drivers/char/vt.c --- a/drivers/char/vt.c~change-return-value-from-schedule_work +++ a/drivers/char/vt.c @@ -262,7 +262,11 @@ static inline void scrolldelta(int lines void schedule_console_callback(void) { - schedule_work(&console_work); + /* + * If a callback is already scheduled then this will fail. + * That's okay; the callback will eventually happen regardless. + */ + (void) add_work(&console_work); } static void scrup(struct vc_data *vc, unsigned int t, unsigned int b, int nr) @@ -3433,7 +3437,7 @@ static void blank_screen_t(unsigned long return; } blank_timer_expired = 1; - schedule_work(&console_work); + schedule_console_callback(); } void poke_blanked_console(void) diff -puN drivers/i2c/chips/isp1301_omap.c~change-return-value-from-schedule_work drivers/i2c/chips/isp1301_omap.c --- a/drivers/i2c/chips/isp1301_omap.c~change-return-value-from-schedule_work +++ a/drivers/i2c/chips/isp1301_omap.c @@ -357,8 +357,8 @@ isp1301_defer_work(struct isp1301 *isp, if (isp && !test_and_set_bit(work, &isp->todo)) { (void) get_device(&isp->client.dev); - status = schedule_work(&isp->work); - if (!status && !isp->working) + status = add_work(&isp->work); + if (status < 0 && !isp->working) dev_vdbg(&isp->client.dev, "work item %d may be lost\n", work); } diff -puN drivers/input/serio/libps2.c~change-return-value-from-schedule_work drivers/input/serio/libps2.c --- a/drivers/input/serio/libps2.c~change-return-value-from-schedule_work +++ a/drivers/input/serio/libps2.c @@ -272,7 +272,7 @@ int ps2_schedule_command(struct ps2dev * memcpy(ps2work->param, param, send); INIT_WORK(&ps2work->work, ps2_execute_scheduled_command, ps2work); - if (!schedule_work(&ps2work->work)) { + if (add_work(&ps2work->work) < 0) { kfree(ps2work); return -1; } diff -puN drivers/net/smc911x.c~change-return-value-from-schedule_work drivers/net/smc911x.c --- a/drivers/net/smc911x.c~change-return-value-from-schedule_work +++ a/drivers/net/smc911x.c @@ -1362,9 +1362,8 @@ static void smc911x_timeout(struct net_d * which calls schedule(). Hence we use a work queue. */ if (lp->phy_type != 0) { - if (schedule_work(&lp->phy_configure)) { + if (add_work(&lp->phy_configure) == 0) lp->work_pending = 1; - } } /* We can accept TX packets again */ diff -puN drivers/net/smc91x.c~change-return-value-from-schedule_work drivers/net/smc91x.c --- a/drivers/net/smc91x.c~change-return-value-from-schedule_work +++ a/drivers/net/smc91x.c @@ -1436,9 +1436,8 @@ static void smc_timeout(struct net_devic * which calls schedule(). Hence we use a work queue. */ if (lp->phy_type != 0) { - if (schedule_work(&lp->phy_configure)) { + if (add_work(&lp->phy_configure) == 0) lp->work_pending = 1; - } } /* We can accept TX packets again */ diff -puN drivers/rtc/rtc-dev.c~change-return-value-from-schedule_work drivers/rtc/rtc-dev.c --- a/drivers/rtc/rtc-dev.c~change-return-value-from-schedule_work +++ a/drivers/rtc/rtc-dev.c @@ -71,7 +71,7 @@ static void rtc_uie_task(void *data) rtc->uie_timer_active = 1; rtc->uie_task_active = 0; add_timer(&rtc->uie_timer); - } else if (schedule_work(&rtc->uie_task) == 0) { + } else if (add_work(&rtc->uie_task) < 0) { rtc->uie_task_active = 0; } spin_unlock_irq(&rtc->irq_lock); @@ -87,7 +87,7 @@ static void rtc_uie_timer(unsigned long spin_lock_irqsave(&rtc->irq_lock, flags); rtc->uie_timer_active = 0; rtc->uie_task_active = 1; - if ((schedule_work(&rtc->uie_task) == 0)) + if (add_work(&rtc->uie_task) < 0) rtc->uie_task_active = 0; spin_unlock_irqrestore(&rtc->irq_lock, flags); } @@ -127,7 +127,7 @@ static int set_uie(struct rtc_device *rt rtc->stop_uie_polling = 0; rtc->oldsecs = tm.tm_sec; rtc->uie_task_active = 1; - if (schedule_work(&rtc->uie_task) == 0) + if (add_work(&rtc->uie_task) < 0) rtc->uie_task_active = 0; } rtc->irq_data = 0; diff -puN drivers/usb/gadget/ether.c~change-return-value-from-schedule_work drivers/usb/gadget/ether.c --- a/drivers/usb/gadget/ether.c~change-return-value-from-schedule_work +++ a/drivers/usb/gadget/ether.c @@ -1604,7 +1604,7 @@ static void defer_kevent (struct eth_dev { if (test_and_set_bit (flag, &dev->todo)) return; - if (!schedule_work (&dev->work)) + if (add_work (&dev->work) < 0) ERROR (dev, "kevent %d may have been dropped\n", flag); else DEBUG (dev, "kevent %d scheduled\n", flag); diff -puN drivers/usb/input/hid-core.c~change-return-value-from-schedule_work drivers/usb/input/hid-core.c --- a/drivers/usb/input/hid-core.c~change-return-value-from-schedule_work +++ a/drivers/usb/input/hid-core.c @@ -988,7 +988,7 @@ static void hid_io_error(struct hid_devi /* Retries failed, so do a port reset */ if (!test_and_set_bit(HID_RESET_PENDING, &hid->iofl)) { - if (schedule_work(&hid->reset_work)) + if (add_work(&hid->reset_work) == 0) goto done; clear_bit(HID_RESET_PENDING, &hid->iofl); } diff -puN drivers/usb/net/usbnet.c~change-return-value-from-schedule_work drivers/usb/net/usbnet.c --- a/drivers/usb/net/usbnet.c~change-return-value-from-schedule_work +++ a/drivers/usb/net/usbnet.c @@ -286,7 +286,7 @@ static void defer_bh(struct usbnet *dev, void usbnet_defer_kevent (struct usbnet *dev, int work) { set_bit (work, &dev->flags); - if (!schedule_work (&dev->kevent)) + if (add_work (&dev->kevent) < 0) deverr (dev, "kevent %d may have been dropped", work); else devdbg (dev, "kevent %d scheduled", work); diff -puN fs/file.c~change-return-value-from-schedule_work fs/file.c --- a/fs/file.c~change-return-value-from-schedule_work +++ a/fs/file.c @@ -85,7 +85,7 @@ static void fdtable_timer(unsigned long */ if (!fddef->next) goto out; - if (!schedule_work(&fddef->wq)) + if (add_work(&fddef->wq) < 0) mod_timer(&fddef->timer, 5); out: spin_unlock(&fddef->lock); @@ -147,7 +147,7 @@ static void free_fdtable_rcu(struct rcu_ * If the per-cpu workqueue is running, then we * defer work scheduling through a timer. */ - if (!schedule_work(&fddef->wq)) + if (add_work(&fddef->wq) < 0) mod_timer(&fddef->timer, 5); spin_unlock(&fddef->lock); put_cpu_var(fdtable_defer_list); diff -puN include/linux/workqueue.h~change-return-value-from-schedule_work include/linux/workqueue.h --- a/include/linux/workqueue.h~change-return-value-from-schedule_work +++ a/include/linux/workqueue.h @@ -69,10 +69,12 @@ extern int add_delayed_work_to_q_on(int struct work_struct *work, unsigned long delay); extern void FASTCALL(flush_workqueue(struct workqueue_struct *wq)); -extern int FASTCALL(schedule_work(struct work_struct *work)); -extern int FASTCALL(schedule_delayed_work(struct work_struct *work, unsigned long delay)); +extern int FASTCALL(add_work(struct work_struct *work)); +extern int FASTCALL(add_delayed_work(struct work_struct *work, + unsigned long delay)); +extern int add_delayed_work_on(int cpu, struct work_struct *work, + unsigned long delay); -extern int schedule_delayed_work_on(int cpu, struct work_struct *work, unsigned long delay); extern int schedule_on_each_cpu(void (*func)(void *info), void *info); extern void flush_scheduled_work(void); extern int current_is_keventd(void); @@ -111,4 +113,10 @@ extern void FASTCALL(queue_delayed_work( extern void queue_delayed_work_on(int cpu, struct workqueue_struct *wq, struct work_struct *work, unsigned long delay); +extern void FASTCALL(schedule_work(struct work_struct *work)); +extern void FASTCALL(schedule_delayed_work(struct work_struct *work, + unsigned long delay)); +extern void schedule_delayed_work_on(int cpu, struct work_struct *work, + unsigned long delay); + #endif diff -puN kernel/workqueue.c~change-return-value-from-schedule_work kernel/workqueue.c --- a/kernel/workqueue.c~change-return-value-from-schedule_work +++ a/kernel/workqueue.c @@ -449,33 +449,33 @@ EXPORT_SYMBOL_GPL(destroy_workqueue); static struct workqueue_struct *keventd_wq; /** - * schedule_work - put work task in global workqueue + * add_work - put work task in global workqueue * @work: job to be done * * This puts a job in the kernel-global workqueue. */ -int fastcall schedule_work(struct work_struct *work) +int fastcall add_work(struct work_struct *work) { - return !add_work_to_q(keventd_wq, work); + return add_work_to_q(keventd_wq, work); } -EXPORT_SYMBOL(schedule_work); +EXPORT_SYMBOL(add_work); /** - * schedule_delayed_work - put work task in global workqueue after delay + * add_delayed_work - put work task in global workqueue after delay * @work: job to be done * @delay: number of jiffies to wait * * After waiting for a given time this puts a job in the kernel-global * workqueue. */ -int fastcall schedule_delayed_work(struct work_struct *work, unsigned long delay) +int fastcall add_delayed_work(struct work_struct *work, unsigned long delay) { - return !add_delayed_work_to_q(keventd_wq, work, delay); + return add_delayed_work_to_q(keventd_wq, work, delay); } -EXPORT_SYMBOL(schedule_delayed_work); +EXPORT_SYMBOL(add_delayed_work); /** - * schedule_delayed_work_on - queue work in global workqueue on CPU after delay + * add_delayed_work_on - queue work in global workqueue on CPU after delay * @cpu: cpu to use * @work: job to be done * @delay: number of jiffies to wait @@ -483,12 +483,12 @@ EXPORT_SYMBOL(schedule_delayed_work); * After waiting for a given time this puts a job in the kernel-global * workqueue on the specified CPU. */ -int schedule_delayed_work_on(int cpu, +int add_delayed_work_on(int cpu, struct work_struct *work, unsigned long delay) { - return !add_delayed_work_to_q_on(cpu, keventd_wq, work, delay); + return add_delayed_work_to_q_on(cpu, keventd_wq, work, delay); } -EXPORT_SYMBOL(schedule_delayed_work_on); +EXPORT_SYMBOL(add_delayed_work_on); /* * Legacy API for use when the return codes aren't needed. @@ -523,6 +523,35 @@ void queue_delayed_work_on(int cpu, stru } EXPORT_SYMBOL_GPL(queue_delayed_work_on); +void fastcall schedule_work(struct work_struct *work) +{ + int rc; + + rc = add_work_to_q(keventd_wq, work); + WARN_ON(rc < 0); +} +EXPORT_SYMBOL_GPL(schedule_work); + +void fastcall schedule_delayed_work(struct work_struct *work, + unsigned long delay) +{ + int rc; + + rc = add_delayed_work_to_q(keventd_wq, work, delay); + WARN_ON(rc < 0); +} +EXPORT_SYMBOL_GPL(schedule_delayed_work); + +void schedule_delayed_work_on(int cpu, struct work_struct *work, + unsigned long delay) +{ + int rc; + + rc = add_delayed_work_to_q_on(cpu, keventd_wq, work, delay); + WARN_ON(rc < 0); +} +EXPORT_SYMBOL_GPL(schedule_delayed_work_on); + /** * schedule_on_each_cpu - call a function on each online CPU from keventd * @func: the function to call _ Patches currently in -mm which might be from stern@xxxxxxxxxxxxxxxxxxx are usb-hub-driver-improve-use-of-ifdef-fix.patch block-layer-early-detection-of-medium-not-present.patch scsi-core-and-sd-early-detection-of-medium-not-present.patch sd-early-detection-of-medium-not-present.patch scsi-early-detection-of-medium-not-present-updated.patch change-return-value-from-schedule_work.patch add-section-on-function-return-values-to-codingstyle.patch add-srcu-based-notifier-chains.patch srcu-report-out-of-memory-errors.patch srcu-report-out-of-memory-errors-fixlet.patch cpufreq-make-the-transition_notifier-chain-use-srcu.patch - To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html