Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ptp: make ptp_clock_info const

Make these const as they are only used in a copy operation.
Done using Coccinelle.

@match disable optional_qualifier@
identifier s;
@@
static struct ptp_clock_info s = {...};

@ref@
position p;
identifier match.s;
@@
s@p

@good1@
position ref.p;
identifier match.s,f,c;
expression e;
@@
(
e = s@p
|
e = s@p.f
|
c(...,s@p.f,...)
|
c(...,s@p,...)
)

@bad depends on !good1@
position ref.p;
identifier match.s;
@@
s@p

@depends on forall !bad disable optional_qualifier@
identifier match.s;
@@
static
+ const
struct ptp_clock_info s;

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Acked-by: Richard Cochran <richardcochran@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Bhumika Goyal and committed by
David S. Miller
7d47e9a2 b6d08bd8

+4 -4
+1 -1
drivers/ptp/ptp_dte.c
··· 221 221 return -EOPNOTSUPP; 222 222 } 223 223 224 - static struct ptp_clock_info ptp_dte_caps = { 224 + static const struct ptp_clock_info ptp_dte_caps = { 225 225 .owner = THIS_MODULE, 226 226 .name = "DTE PTP timer", 227 227 .max_adj = 50000000,
+1 -1
drivers/ptp/ptp_ixp46x.c
··· 236 236 return -EOPNOTSUPP; 237 237 } 238 238 239 - static struct ptp_clock_info ptp_ixp_caps = { 239 + static const struct ptp_clock_info ptp_ixp_caps = { 240 240 .owner = THIS_MODULE, 241 241 .name = "IXP46X timer", 242 242 .max_adj = 66666655,
+1 -1
drivers/ptp/ptp_kvm.c
··· 150 150 return -EOPNOTSUPP; 151 151 } 152 152 153 - static struct ptp_clock_info ptp_kvm_caps = { 153 + static const struct ptp_clock_info ptp_kvm_caps = { 154 154 .owner = THIS_MODULE, 155 155 .name = "KVM virtual PTP", 156 156 .max_adj = 0,
+1 -1
drivers/ptp/ptp_pch.c
··· 509 509 return -EOPNOTSUPP; 510 510 } 511 511 512 - static struct ptp_clock_info ptp_pch_caps = { 512 + static const struct ptp_clock_info ptp_pch_caps = { 513 513 .owner = THIS_MODULE, 514 514 .name = "PCH timer", 515 515 .max_adj = 50000000,