xenbus: frontend resume cleanup
PATCH 1/1 xenbus: frontend resume cleanup
Only create the delayed resume workqueue if we are running in the same domain as xenstored and issue a warning if the workqueue creation fails.
Move the work initialization to the device probe so it is done only once.
--- drivers/xen/xenbus/xenbus_probe_frontend.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-)
drivers/xen/xenbus/xenbus_probe_frontend.c +17 -3
@@ -115,7 +115,6 @@ static int xenbus_frontend_dev_resume(struct device *dev)return -EFAULT ; } -INIT_WORK (&xdev->work, xenbus_frontend_delayed_resume);queue_work (xenbus_frontend_wq, &xdev->work);return 0 ;
@@ -124,6 +123,16 @@ static int xenbus_frontend_dev_resume(struct device *dev)return xenbus_dev_resume (dev); } +static int xenbus_frontend_dev_probe (struct device *dev) +{ +if (xen_store_domain_type ==XS_LOCAL ) { +struct xenbus_device *xdev =to_xenbus_device (dev); +INIT_WORK (&xdev->work, xenbus_frontend_delayed_resume); + } + +return xenbus_dev_probe (dev); +} +static const struct dev_pm_ops xenbus_pm_ops = { .suspend = xenbus_dev_suspend, .resume = xenbus_frontend_dev_resume,
@@ -142,7 +151,7 @@ static struct xen_bus_type xenbus_frontend = { .name = "xen", .match = xenbus_match, .uevent = xenbus_uevent_frontend, - .probe = xenbus_dev_probe, + .probe = xenbus_frontend_dev_probe, .remove = xenbus_dev_remove, .shutdown = xenbus_dev_shutdown, .dev_attrs = xenbus_dev_attrs,
@@ -474,7 +483,12 @@ static int __init xenbus_probe_frontend_init(void)register_xenstore_notifier (&xenstore_notifier); - xenbus_frontend_wq =create_workqueue ("xenbus_frontend" ); +if (xen_store_domain_type ==XS_LOCAL ) { + xenbus_frontend_wq =create_workqueue ("xenbus_frontend" ); +if (!xenbus_frontend_wq) +pr_warn ("create xenbus frontend workqueue failed, " +"S3 resume is likely to fail\n" ); + }return 0 ; }
Signature · 1 line
1.7.10.4
Quoted 6 lines · Aurelien Chartier
Only create the delayed resume workqueue if we are running in the same domain as xenstored and issue a warning if the workqueue creation fails.
Move the work initialization to the device probe so it is done only once.
Signed-off-by Aurelien Chartier <[email protected]>
David
Quoted 50 lines · Aurelien Chartier
Only create the delayed resume workqueue if we are running in the same domain as xenstored and issue a warning if the workqueue creation fails.
Move the work initialization to the device probe so it is done only once.
Signed-off-by Aurelien Chartier <[email protected]>--- drivers/xen/xenbus/xenbus_probe_frontend.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-)drivers/xen/xenbus/xenbus_probe_frontend.c +11
-2@@ -115,7 +115,6 @@ static int xenbus_frontend_dev_resume(struct device *dev)return -EFAULT ; } -INIT_WORK (&xdev->work, xenbus_frontend_delayed_resume);queue_work (xenbus_frontend_wq, &xdev->work);return 0 ;@@ -124,6 +123,16 @@ static int xenbus_frontend_dev_resume(struct device *dev)return xenbus_dev_resume (dev); } +static int xenbus_frontend_dev_probe (struct device *dev) +{ +if (xen_store_domain_type ==XS_LOCAL ) { +struct xenbus_device *xdev =to_xenbus_device (dev); +INIT_WORK (&xdev->work, xenbus_frontend_delayed_resume); + } + +return xenbus_dev_probe (dev); +} +static const struct dev_pm_ops xenbus_pm_ops = { .suspend = xenbus_dev_suspend, .resume = xenbus_frontend_dev_resume,@@ -142,7 +151,7 @@ static struct xen_bus_type xenbus_frontend = { .name = "xen", .match = xenbus_match, .uevent = xenbus_uevent_frontend, - .probe = xenbus_dev_probe, + .probe = xenbus_frontend_dev_probe, .remove = xenbus_dev_remove, .shutdown = xenbus_dev_shutdown, .dev_attrs = xenbus_dev_attrs,@@ -474,7 +483,12 @@ static int __init xenbus_probe_frontend_init(void)
drivers/xen/xenbus/xenbus_probe_frontend.c static int __init xenbus_probe_frontend_init(void) · line 492
Quoted 10 lines
drivers/xen/xenbus/xenbus_probe_frontend.c +6
-1register_xenstore_notifier (&xenstore_notifier); - xenbus_frontend_wq =create_workqueue ("xenbus_frontend" ); +if (xen_store_domain_type ==XS_LOCAL ) { + xenbus_frontend_wq =create_workqueue ("xenbus_frontend" ); +if (!xenbus_frontend_wq) +pr_warn ("create xenbus frontend workqueue failed, " +"S3 resume is likely to fail\n" ); + }
Nice patch. I am going to take it but rework the line above - the rule about 80 characters does not apply to any printk so it can all be in one line. Will rework it when I commit it in.
Quoted 5 lines
drivers/xen/xenbus/xenbus_probe_frontend.c +0
-0return 0 ; }Signature · 1 line
1.7.10.4
Quoted 53 lines · Konrad Rzeszutek Wilk
Quoted 52 lines · Aurelien Chartier
Only create the delayed resume workqueue if we are running in the same domain as xenstored and issue a warning if the workqueue creation fails.
Move the work initialization to the device probe so it is done only once.
Signed-off-by Aurelien Chartier <[email protected]>--- drivers/xen/xenbus/xenbus_probe_frontend.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-)drivers/xen/xenbus/xenbus_probe_frontend.c +11
-2@@ -115,7 +115,6 @@ static int xenbus_frontend_dev_resume(struct device *dev)return -EFAULT ; } -INIT_WORK (&xdev->work, xenbus_frontend_delayed_resume);queue_work (xenbus_frontend_wq, &xdev->work);return 0 ;@@ -124,6 +123,16 @@ static int xenbus_frontend_dev_resume(struct device *dev)return xenbus_dev_resume (dev); } +static int xenbus_frontend_dev_probe (struct device *dev) +{ +if (xen_store_domain_type ==XS_LOCAL ) { +struct xenbus_device *xdev =to_xenbus_device (dev); +INIT_WORK (&xdev->work, xenbus_frontend_delayed_resume); + } + +return xenbus_dev_probe (dev); +} +static const struct dev_pm_ops xenbus_pm_ops = { .suspend = xenbus_dev_suspend, .resume = xenbus_frontend_dev_resume,@@ -142,7 +151,7 @@ static struct xen_bus_type xenbus_frontend = { .name = "xen", .match = xenbus_match, .uevent = xenbus_uevent_frontend, - .probe = xenbus_dev_probe, + .probe = xenbus_frontend_dev_probe, .remove = xenbus_dev_remove, .shutdown = xenbus_dev_shutdown, .dev_attrs = xenbus_dev_attrs,@@ -474,7 +483,12 @@ static int __init xenbus_probe_frontend_init(void)register_xenstore_notifier (&xenstore_notifier);
Quoted 10 lines
drivers/xen/xenbus/xenbus_probe_frontend.c static int __init xenbus_probe_frontend_init(void) · line 492
Quoted 8 lines
drivers/xen/xenbus/xenbus_probe_frontend.c +6
-1- xenbus_frontend_wq =create_workqueue ("xenbus_frontend" ); +if (xen_store_domain_type ==XS_LOCAL ) { + xenbus_frontend_wq =create_workqueue ("xenbus_frontend" ); +if (!xenbus_frontend_wq) +pr_warn ("create xenbus frontend workqueue failed, " +"S3 resume is likely to fail\n" ); + }Nice patch. I am going to take it but rework the line above - the rule about 80 characters does not apply to any printk so it can all be in one line. Will rework it when I commit it in.
I did not think there was an exception, good to know.
Thanks Konrad !
Quoted 6 lines
Quoted 6 lines
drivers/xen/xenbus/xenbus_probe_frontend.c +0
-0return 0 ; }Signature · 1 line
1.7.10.4