Message ID | 20170824142239.15178-1-boqun.feng@gmail.com (mailing list archive) |
---|---|
State | Not Applicable, archived |
Headers | show |
On Thu, Aug 24, 2017 at 10:22:36PM +0800, Boqun Feng wrote: > COMPLETION_INITIALIZER_ONSTACK() is supposed to used as an initializer, > in other words, it should only be used in assignment expressions or > compound literals. So the usage in drivers/acpi/nfit/core.c: > > COMPLETION_INITIALIZER_ONSTACK(flush.cmp); > > , is inappropriate. > > Besides, this usage could also break compilations for another fix to > reduce stack sizes caused by COMPLETION_INITIALIZER_ONSTACK(), because > that fix changes COMPLETION_INITIALIZER_ONSTACK() from rvalue to lvalue, > and usage as above will report error: > > drivers/acpi/nfit/core.c: In function 'acpi_nfit_flush_probe': > include/linux/completion.h:77:3: error: value computed is not used [-Werror=unused-value] > (*({ init_completion(&work); &work; })) > > This patch fixes this by replacing COMPLETION_INITIALIZER_ONSTACK() with > init_completion() in acpi_nfit_flush_probe(), which does the same > initialization without any other problem. > > Signed-off-by: Boqun Feng <boqun.feng@gmail.com> > --- Sorry, forget to metion: v1 --> v2: Improve the commit log, based on Dan, Thomas and Arnd's comments. Only V2 of this patch #1 is updated. Regards, Boqun > drivers/acpi/nfit/core.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/acpi/nfit/core.c b/drivers/acpi/nfit/core.c > index 19182d091587..1893e416e7c0 100644 > --- a/drivers/acpi/nfit/core.c > +++ b/drivers/acpi/nfit/core.c > @@ -2884,7 +2884,7 @@ static int acpi_nfit_flush_probe(struct nvdimm_bus_descriptor *nd_desc) > * need to be interruptible while waiting. > */ > INIT_WORK_ONSTACK(&flush.work, flush_probe); > - COMPLETION_INITIALIZER_ONSTACK(flush.cmp); > + init_completion(&flush.cmp); > queue_work(nfit_wq, &flush.work); > mutex_unlock(&acpi_desc->init_mutex); > > -- > 2.14.1 >
On Thu, Aug 24, 2017 at 7:22 AM, Boqun Feng <boqun.feng@gmail.com> wrote: > COMPLETION_INITIALIZER_ONSTACK() is supposed to used as an initializer, > in other words, it should only be used in assignment expressions or > compound literals. So the usage in drivers/acpi/nfit/core.c: > > COMPLETION_INITIALIZER_ONSTACK(flush.cmp); > > , is inappropriate. > > Besides, this usage could also break compilations for another fix to > reduce stack sizes caused by COMPLETION_INITIALIZER_ONSTACK(), because > that fix changes COMPLETION_INITIALIZER_ONSTACK() from rvalue to lvalue, > and usage as above will report error: > > drivers/acpi/nfit/core.c: In function 'acpi_nfit_flush_probe': > include/linux/completion.h:77:3: error: value computed is not used [-Werror=unused-value] > (*({ init_completion(&work); &work; })) > > This patch fixes this by replacing COMPLETION_INITIALIZER_ONSTACK() with > init_completion() in acpi_nfit_flush_probe(), which does the same > initialization without any other problem. > > Signed-off-by: Boqun Feng <boqun.feng@gmail.com> Acked-by: Dan Williams <dan.j.williams@intel.com> -- To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/acpi/nfit/core.c b/drivers/acpi/nfit/core.c index 19182d091587..1893e416e7c0 100644 --- a/drivers/acpi/nfit/core.c +++ b/drivers/acpi/nfit/core.c @@ -2884,7 +2884,7 @@ static int acpi_nfit_flush_probe(struct nvdimm_bus_descriptor *nd_desc) * need to be interruptible while waiting. */ INIT_WORK_ONSTACK(&flush.work, flush_probe); - COMPLETION_INITIALIZER_ONSTACK(flush.cmp); + init_completion(&flush.cmp); queue_work(nfit_wq, &flush.work); mutex_unlock(&acpi_desc->init_mutex);
COMPLETION_INITIALIZER_ONSTACK() is supposed to used as an initializer, in other words, it should only be used in assignment expressions or compound literals. So the usage in drivers/acpi/nfit/core.c: COMPLETION_INITIALIZER_ONSTACK(flush.cmp); , is inappropriate. Besides, this usage could also break compilations for another fix to reduce stack sizes caused by COMPLETION_INITIALIZER_ONSTACK(), because that fix changes COMPLETION_INITIALIZER_ONSTACK() from rvalue to lvalue, and usage as above will report error: drivers/acpi/nfit/core.c: In function 'acpi_nfit_flush_probe': include/linux/completion.h:77:3: error: value computed is not used [-Werror=unused-value] (*({ init_completion(&work); &work; })) This patch fixes this by replacing COMPLETION_INITIALIZER_ONSTACK() with init_completion() in acpi_nfit_flush_probe(), which does the same initialization without any other problem. Signed-off-by: Boqun Feng <boqun.feng@gmail.com> --- drivers/acpi/nfit/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)