Message ID | 1341903738-1791-2-git-send-email-sachin.kamat@linaro.org |
---|---|
State | Accepted |
Headers | show |
On Tuesday, July 10, 2012, Sachin Kamat wrote: > Fixes the following sparse warning: > drivers/base/power/domain.c:1679:55: warning: Using plain integer as NULL pointer > > Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> > --- > drivers/base/power/domain.c | 2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) > > diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c > index 4f8e0d2..8d67417 100644 > --- a/drivers/base/power/domain.c > +++ b/drivers/base/power/domain.c > @@ -1676,7 +1676,7 @@ int __pm_genpd_remove_callbacks(struct device *dev, bool clear_td) > > if (dev->power.subsys_data->domain_data) { > gpd_data = to_gpd_data(dev->power.subsys_data->domain_data); > - gpd_data->ops = (struct gpd_dev_ops){ 0 }; > + gpd_data->ops = (struct gpd_dev_ops){ NULL }; This doesn't seem to be correct, because gpd_data->ops is not a pointer. Thanks, Rafael > if (clear_td) > gpd_data->td = (struct gpd_timing_data){ 0 }; > >
On 10/07/2012, Rafael J. Wysocki <rjw@sisk.pl> wrote: > On Tuesday, July 10, 2012, Sachin Kamat wrote: >> Fixes the following sparse warning: >> drivers/base/power/domain.c:1679:55: warning: Using plain integer as NULL >> pointer >> >> Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> >> --- >> drivers/base/power/domain.c | 2 +- >> 1 files changed, 1 insertions(+), 1 deletions(-) >> >> diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c >> index 4f8e0d2..8d67417 100644 >> --- a/drivers/base/power/domain.c >> +++ b/drivers/base/power/domain.c >> @@ -1676,7 +1676,7 @@ int __pm_genpd_remove_callbacks(struct device *dev, >> bool clear_td) >> >> if (dev->power.subsys_data->domain_data) { >> gpd_data = to_gpd_data(dev->power.subsys_data->domain_data); >> - gpd_data->ops = (struct gpd_dev_ops){ 0 }; >> + gpd_data->ops = (struct gpd_dev_ops){ NULL }; > > This doesn't seem to be correct, because gpd_data->ops is not a pointer. struct gpd_dev_ops (gpd_data->ops) being a structure of function pointers (as shown below), I thought it would be appropriate to initialise the members to NULL instead of 0. struct gpd_dev_ops { int (*start)(struct device *dev); int (*stop)(struct device *dev); int (*save_state)(struct device *dev); int (*restore_state)(struct device *dev); int (*suspend)(struct device *dev); int (*suspend_late)(struct device *dev); int (*resume_early)(struct device *dev); int (*resume)(struct device *dev); int (*freeze)(struct device *dev); int (*freeze_late)(struct device *dev); int (*thaw_early)(struct device *dev); int (*thaw)(struct device *dev); bool (*active_wakeup)(struct device *dev); }; > > Thanks, > Rafael > > >> if (clear_td) >> gpd_data->td = (struct gpd_timing_data){ 0 }; >> >> > >
On Wednesday, July 11, 2012, Sachin Kamat wrote: > On 10/07/2012, Rafael J. Wysocki <rjw@sisk.pl> wrote: > > On Tuesday, July 10, 2012, Sachin Kamat wrote: > >> Fixes the following sparse warning: > >> drivers/base/power/domain.c:1679:55: warning: Using plain integer as NULL > >> pointer > >> > >> Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> > >> --- > >> drivers/base/power/domain.c | 2 +- > >> 1 files changed, 1 insertions(+), 1 deletions(-) > >> > >> diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c > >> index 4f8e0d2..8d67417 100644 > >> --- a/drivers/base/power/domain.c > >> +++ b/drivers/base/power/domain.c > >> @@ -1676,7 +1676,7 @@ int __pm_genpd_remove_callbacks(struct device *dev, > >> bool clear_td) > >> > >> if (dev->power.subsys_data->domain_data) { > >> gpd_data = to_gpd_data(dev->power.subsys_data->domain_data); > >> - gpd_data->ops = (struct gpd_dev_ops){ 0 }; > >> + gpd_data->ops = (struct gpd_dev_ops){ NULL }; > > > > This doesn't seem to be correct, because gpd_data->ops is not a pointer. > > struct gpd_dev_ops (gpd_data->ops) being a structure of function > pointers (as shown below), I thought it would be appropriate to > initialise the members to NULL instead of 0. Ah, OK. So perhaps it would be useful to put a comma after the NULL? Rafael > struct gpd_dev_ops { > int (*start)(struct device *dev); > int (*stop)(struct device *dev); > int (*save_state)(struct device *dev); > int (*restore_state)(struct device *dev); > int (*suspend)(struct device *dev); > int (*suspend_late)(struct device *dev); > int (*resume_early)(struct device *dev); > int (*resume)(struct device *dev); > int (*freeze)(struct device *dev); > int (*freeze_late)(struct device *dev); > int (*thaw_early)(struct device *dev); > int (*thaw)(struct device *dev); > bool (*active_wakeup)(struct device *dev); > };
On 11/07/2012, Rafael J. Wysocki <rjw@sisk.pl> wrote: > On Wednesday, July 11, 2012, Sachin Kamat wrote: >> On 10/07/2012, Rafael J. Wysocki <rjw@sisk.pl> wrote: >> > On Tuesday, July 10, 2012, Sachin Kamat wrote: >> >> Fixes the following sparse warning: >> >> drivers/base/power/domain.c:1679:55: warning: Using plain integer as >> >> NULL >> >> pointer >> >> >> >> Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> >> >> --- >> >> drivers/base/power/domain.c | 2 +- >> >> 1 files changed, 1 insertions(+), 1 deletions(-) >> >> >> >> diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c >> >> index 4f8e0d2..8d67417 100644 >> >> --- a/drivers/base/power/domain.c >> >> +++ b/drivers/base/power/domain.c >> >> @@ -1676,7 +1676,7 @@ int __pm_genpd_remove_callbacks(struct device >> >> *dev, >> >> bool clear_td) >> >> >> >> if (dev->power.subsys_data->domain_data) { >> >> gpd_data = to_gpd_data(dev->power.subsys_data->domain_data); >> >> - gpd_data->ops = (struct gpd_dev_ops){ 0 }; >> >> + gpd_data->ops = (struct gpd_dev_ops){ NULL }; >> > >> > This doesn't seem to be correct, because gpd_data->ops is not a >> > pointer. >> >> struct gpd_dev_ops (gpd_data->ops) being a structure of function >> pointers (as shown below), I thought it would be appropriate to >> initialise the members to NULL instead of 0. > > Ah, OK. So perhaps it would be useful to put a comma after the NULL? > I would prefer to leave it at that (without comma). However if you think adding a comma would be appropriate, I can send you the updated patch. Please let me know. > Rafael > > >> struct gpd_dev_ops { >> int (*start)(struct device *dev); >> int (*stop)(struct device *dev); >> int (*save_state)(struct device *dev); >> int (*restore_state)(struct device *dev); >> int (*suspend)(struct device *dev); >> int (*suspend_late)(struct device *dev); >> int (*resume_early)(struct device *dev); >> int (*resume)(struct device *dev); >> int (*freeze)(struct device *dev); >> int (*freeze_late)(struct device *dev); >> int (*thaw_early)(struct device *dev); >> int (*thaw)(struct device *dev); >> bool (*active_wakeup)(struct device *dev); >> }; >
On Wednesday, July 11, 2012, Sachin Kamat wrote: > On 11/07/2012, Rafael J. Wysocki <rjw@sisk.pl> wrote: > > On Wednesday, July 11, 2012, Sachin Kamat wrote: > >> On 10/07/2012, Rafael J. Wysocki <rjw@sisk.pl> wrote: > >> > On Tuesday, July 10, 2012, Sachin Kamat wrote: > >> >> Fixes the following sparse warning: > >> >> drivers/base/power/domain.c:1679:55: warning: Using plain integer as > >> >> NULL > >> >> pointer > >> >> > >> >> Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> > >> >> --- > >> >> drivers/base/power/domain.c | 2 +- > >> >> 1 files changed, 1 insertions(+), 1 deletions(-) > >> >> > >> >> diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c > >> >> index 4f8e0d2..8d67417 100644 > >> >> --- a/drivers/base/power/domain.c > >> >> +++ b/drivers/base/power/domain.c > >> >> @@ -1676,7 +1676,7 @@ int __pm_genpd_remove_callbacks(struct device > >> >> *dev, > >> >> bool clear_td) > >> >> > >> >> if (dev->power.subsys_data->domain_data) { > >> >> gpd_data = to_gpd_data(dev->power.subsys_data->domain_data); > >> >> - gpd_data->ops = (struct gpd_dev_ops){ 0 }; > >> >> + gpd_data->ops = (struct gpd_dev_ops){ NULL }; > >> > > >> > This doesn't seem to be correct, because gpd_data->ops is not a > >> > pointer. > >> > >> struct gpd_dev_ops (gpd_data->ops) being a structure of function > >> pointers (as shown below), I thought it would be appropriate to > >> initialise the members to NULL instead of 0. > > > > Ah, OK. So perhaps it would be useful to put a comma after the NULL? > > > I would prefer to leave it at that (without comma). However if you > think adding a comma would be appropriate, I can send you the updated > patch. Please let me know. OK, I'll apply your original patch. Thanks, Rafael > >> struct gpd_dev_ops { > >> int (*start)(struct device *dev); > >> int (*stop)(struct device *dev); > >> int (*save_state)(struct device *dev); > >> int (*restore_state)(struct device *dev); > >> int (*suspend)(struct device *dev); > >> int (*suspend_late)(struct device *dev); > >> int (*resume_early)(struct device *dev); > >> int (*resume)(struct device *dev); > >> int (*freeze)(struct device *dev); > >> int (*freeze_late)(struct device *dev); > >> int (*thaw_early)(struct device *dev); > >> int (*thaw)(struct device *dev); > >> bool (*active_wakeup)(struct device *dev); > >> }; > > > > >
diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index 4f8e0d2..8d67417 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c @@ -1676,7 +1676,7 @@ int __pm_genpd_remove_callbacks(struct device *dev, bool clear_td) if (dev->power.subsys_data->domain_data) { gpd_data = to_gpd_data(dev->power.subsys_data->domain_data); - gpd_data->ops = (struct gpd_dev_ops){ 0 }; + gpd_data->ops = (struct gpd_dev_ops){ NULL }; if (clear_td) gpd_data->td = (struct gpd_timing_data){ 0 };
Fixes the following sparse warning: drivers/base/power/domain.c:1679:55: warning: Using plain integer as NULL pointer Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> --- drivers/base/power/domain.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)