Re: [PATCH] thermal/intel_powerclamp: add const to thermal_cooling_device_ops structure

From: Zhang Rui
Date: Thu Jun 29 2017 - 01:32:49 EST


On Thu, 2017-06-29 at 10:41 +0530, Bhumika Goyal wrote:
> On Thu, Jun 29, 2017 at 8:30 AM, Zhang Rui <rui.zhang@xxxxxxxxx>
> wrote:
> >
> > On Wed, 2017-06-21 at 12:39 +0530, Bhumika Goyal wrote:
> > >
> > > Declare thermal_cooling_device_ops structure as const as it is
> > > only
> > > passed
> > > as an argument to the function thermal_cooling_device_register
> > > and
> > > this
> > > argument is of type const. So, declare the structure as const.
> > >
> > I checked the source and the code is written in this way as well in
> > some other drivers, why not fix them altogether?
> >
> Hey,
>
> I have already sent the patches for the drivers requiring this
> change.
> Some of them got applied as well.

I mean the other drivers that use thermal_cooling_device_ops.

Surely I can applied this patch, but still it would be nice if you can
check the other places that defines thermal_cooling_device_ops and fix
all of them in one time. :)

thanks,
rui
>
> Thanks,
> Bhumika
>
> >
> > thanks,
> > rui
> > >
> > > Signed-off-by: Bhumika Goyal <bhumirks@xxxxxxxxx>
> > > ---
> > > Âdrivers/thermal/intel_powerclamp.c | 2 +-
> > > Â1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/thermal/intel_powerclamp.c
> > > b/drivers/thermal/intel_powerclamp.c
> > > index d718cd1..e4c68b7 100644
> > > --- a/drivers/thermal/intel_powerclamp.c
> > > +++ b/drivers/thermal/intel_powerclamp.c
> > > @@ -659,7 +659,7 @@ static int powerclamp_set_cur_state(struct
> > > thermal_cooling_device *cdev,
> > > Â}
> > >
> > > Â/* bind to generic thermal layer as cooling device*/
> > > -static struct thermal_cooling_device_ops powerclamp_cooling_ops
> > > = {
> > > +static const struct thermal_cooling_device_ops
> > > powerclamp_cooling_ops = {
> > > ÂÂÂÂÂÂ.get_max_state = powerclamp_get_max_state,
> > > ÂÂÂÂÂÂ.get_cur_state = powerclamp_get_cur_state,
> > > ÂÂÂÂÂÂ.set_cur_state = powerclamp_set_cur_state,