linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] counter: microchip-tcb-capture: Constify mchp_tc_ops
@ 2020-09-22 20:19 Rikard Falkeborn
  2020-09-23  1:48 ` William Breathitt Gray
  0 siblings, 1 reply; 3+ messages in thread
From: Rikard Falkeborn @ 2020-09-22 20:19 UTC (permalink / raw)
  To: William Breathitt Gray, Kamel Bouhara
  Cc: linux-iio, linux-kernel, Jonathan Cameron, Rikard Falkeborn

The only usage of mchp_tc_ops is to assign its address to the ops field
in the counter_device struct which is a const pointer. Make it const to
allow the compiler to put it in read-only memory.

Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
---
 drivers/counter/microchip-tcb-capture.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/counter/microchip-tcb-capture.c b/drivers/counter/microchip-tcb-capture.c
index b7b252c5addf..039c54a78aa5 100644
--- a/drivers/counter/microchip-tcb-capture.c
+++ b/drivers/counter/microchip-tcb-capture.c
@@ -253,7 +253,7 @@ static struct counter_count mchp_tc_counts[] = {
 	},
 };
 
-static struct counter_ops mchp_tc_ops = {
+static const struct counter_ops mchp_tc_ops = {
 	.signal_read  = mchp_tc_count_signal_read,
 	.count_read   = mchp_tc_count_read,
 	.function_get = mchp_tc_count_function_get,
-- 
2.28.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] counter: microchip-tcb-capture: Constify mchp_tc_ops
  2020-09-22 20:19 [PATCH] counter: microchip-tcb-capture: Constify mchp_tc_ops Rikard Falkeborn
@ 2020-09-23  1:48 ` William Breathitt Gray
  2020-09-23 19:56   ` Jonathan Cameron
  0 siblings, 1 reply; 3+ messages in thread
From: William Breathitt Gray @ 2020-09-23  1:48 UTC (permalink / raw)
  To: Rikard Falkeborn, Jonathan Cameron; +Cc: Kamel Bouhara, linux-iio, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1101 bytes --]

On Tue, Sep 22, 2020 at 10:19:41PM +0200, Rikard Falkeborn wrote:
> The only usage of mchp_tc_ops is to assign its address to the ops field
> in the counter_device struct which is a const pointer. Make it const to
> allow the compiler to put it in read-only memory.
> 
> Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>

Acked-by: William Breathitt Gray <vilhelm.gray@gmail.com>

> ---
>  drivers/counter/microchip-tcb-capture.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/counter/microchip-tcb-capture.c b/drivers/counter/microchip-tcb-capture.c
> index b7b252c5addf..039c54a78aa5 100644
> --- a/drivers/counter/microchip-tcb-capture.c
> +++ b/drivers/counter/microchip-tcb-capture.c
> @@ -253,7 +253,7 @@ static struct counter_count mchp_tc_counts[] = {
>  	},
>  };
>  
> -static struct counter_ops mchp_tc_ops = {
> +static const struct counter_ops mchp_tc_ops = {
>  	.signal_read  = mchp_tc_count_signal_read,
>  	.count_read   = mchp_tc_count_read,
>  	.function_get = mchp_tc_count_function_get,
> -- 
> 2.28.0
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] counter: microchip-tcb-capture: Constify mchp_tc_ops
  2020-09-23  1:48 ` William Breathitt Gray
@ 2020-09-23 19:56   ` Jonathan Cameron
  0 siblings, 0 replies; 3+ messages in thread
From: Jonathan Cameron @ 2020-09-23 19:56 UTC (permalink / raw)
  To: William Breathitt Gray
  Cc: Rikard Falkeborn, Jonathan Cameron, Kamel Bouhara, linux-iio,
	linux-kernel

On Tue, 22 Sep 2020 21:48:38 -0400
William Breathitt Gray <vilhelm.gray@gmail.com> wrote:

> On Tue, Sep 22, 2020 at 10:19:41PM +0200, Rikard Falkeborn wrote:
> > The only usage of mchp_tc_ops is to assign its address to the ops field
> > in the counter_device struct which is a const pointer. Make it const to
> > allow the compiler to put it in read-only memory.
> > 
> > Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>  
> 
> Acked-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Applied to the togreg branch of iio.git and pushed out as testing for
the autobuilders to poke at it.

I'm not sure if I'll get another pull request out this cycle, so it
may have to wait for 5.11.

Thanks,

Jonathan

> 
> > ---
> >  drivers/counter/microchip-tcb-capture.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/counter/microchip-tcb-capture.c b/drivers/counter/microchip-tcb-capture.c
> > index b7b252c5addf..039c54a78aa5 100644
> > --- a/drivers/counter/microchip-tcb-capture.c
> > +++ b/drivers/counter/microchip-tcb-capture.c
> > @@ -253,7 +253,7 @@ static struct counter_count mchp_tc_counts[] = {
> >  	},
> >  };
> >  
> > -static struct counter_ops mchp_tc_ops = {
> > +static const struct counter_ops mchp_tc_ops = {
> >  	.signal_read  = mchp_tc_count_signal_read,
> >  	.count_read   = mchp_tc_count_read,
> >  	.function_get = mchp_tc_count_function_get,
> > -- 
> > 2.28.0
> >   


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-09-23 19:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-09-22 20:19 [PATCH] counter: microchip-tcb-capture: Constify mchp_tc_ops Rikard Falkeborn
2020-09-23  1:48 ` William Breathitt Gray
2020-09-23 19:56   ` Jonathan Cameron

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).