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

[media] constify local structures

For structure types defined in the same file or local header files, find
top-level static structure declarations that have the following
properties:
1. Never reassigned.
2. Address never taken
3. Not passed to a top-level macro call
4. No pointer or array-typed field passed to a function or stored in a
variable.
Declare structures having all of these properties as const.

Done using Coccinelle.
Based on a suggestion by Joe Perches <joe@perches.com>.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>

authored by

Julia Lawall and committed by
Mauro Carvalho Chehab
db83d08d 10accd2e

+21 -21
+1 -1
drivers/media/i2c/tvp514x.c
··· 977 977 .pad = &tvp514x_pad_ops, 978 978 }; 979 979 980 - static struct tvp514x_decoder tvp514x_dev = { 980 + static const struct tvp514x_decoder tvp514x_dev = { 981 981 .streaming = 0, 982 982 .fmt_list = tvp514x_fmt_list, 983 983 .num_fmts = ARRAY_SIZE(tvp514x_fmt_list),
+9 -9
drivers/media/pci/ddbridge/ddbridge-core.c
··· 1643 1643 /******************************************************************************/ 1644 1644 /******************************************************************************/ 1645 1645 1646 - static struct ddb_info ddb_none = { 1646 + static const struct ddb_info ddb_none = { 1647 1647 .type = DDB_NONE, 1648 1648 .name = "Digital Devices PCIe bridge", 1649 1649 }; 1650 1650 1651 - static struct ddb_info ddb_octopus = { 1651 + static const struct ddb_info ddb_octopus = { 1652 1652 .type = DDB_OCTOPUS, 1653 1653 .name = "Digital Devices Octopus DVB adapter", 1654 1654 .port_num = 4, 1655 1655 }; 1656 1656 1657 - static struct ddb_info ddb_octopus_le = { 1657 + static const struct ddb_info ddb_octopus_le = { 1658 1658 .type = DDB_OCTOPUS, 1659 1659 .name = "Digital Devices Octopus LE DVB adapter", 1660 1660 .port_num = 2, 1661 1661 }; 1662 1662 1663 - static struct ddb_info ddb_octopus_mini = { 1663 + static const struct ddb_info ddb_octopus_mini = { 1664 1664 .type = DDB_OCTOPUS, 1665 1665 .name = "Digital Devices Octopus Mini", 1666 1666 .port_num = 4, 1667 1667 }; 1668 1668 1669 - static struct ddb_info ddb_v6 = { 1669 + static const struct ddb_info ddb_v6 = { 1670 1670 .type = DDB_OCTOPUS, 1671 1671 .name = "Digital Devices Cine S2 V6 DVB adapter", 1672 1672 .port_num = 3, 1673 1673 }; 1674 - static struct ddb_info ddb_v6_5 = { 1674 + static const struct ddb_info ddb_v6_5 = { 1675 1675 .type = DDB_OCTOPUS, 1676 1676 .name = "Digital Devices Cine S2 V6.5 DVB adapter", 1677 1677 .port_num = 4, 1678 1678 }; 1679 1679 1680 - static struct ddb_info ddb_dvbct = { 1680 + static const struct ddb_info ddb_dvbct = { 1681 1681 .type = DDB_OCTOPUS, 1682 1682 .name = "Digital Devices DVBCT V6.1 DVB adapter", 1683 1683 .port_num = 3, 1684 1684 }; 1685 1685 1686 - static struct ddb_info ddb_satixS2v3 = { 1686 + static const struct ddb_info ddb_satixS2v3 = { 1687 1687 .type = DDB_OCTOPUS, 1688 1688 .name = "Mystique SaTiX-S2 V3 DVB adapter", 1689 1689 .port_num = 3, 1690 1690 }; 1691 1691 1692 - static struct ddb_info ddb_octopusv3 = { 1692 + static const struct ddb_info ddb_octopusv3 = { 1693 1693 .type = DDB_OCTOPUS, 1694 1694 .name = "Digital Devices Octopus V3 DVB adapter", 1695 1695 .port_num = 4,
+7 -7
drivers/media/pci/ngene/ngene-cards.c
··· 613 613 .clk_div = 1, 614 614 }; 615 615 616 - static struct ngene_info ngene_info_cineS2 = { 616 + static const struct ngene_info ngene_info_cineS2 = { 617 617 .type = NGENE_SIDEWINDER, 618 618 .name = "Linux4Media cineS2 DVB-S2 Twin Tuner", 619 619 .io_type = {NGENE_IO_TSIN, NGENE_IO_TSIN}, ··· 627 627 .msi_supported = true, 628 628 }; 629 629 630 - static struct ngene_info ngene_info_satixS2 = { 630 + static const struct ngene_info ngene_info_satixS2 = { 631 631 .type = NGENE_SIDEWINDER, 632 632 .name = "Mystique SaTiX-S2 Dual", 633 633 .io_type = {NGENE_IO_TSIN, NGENE_IO_TSIN}, ··· 641 641 .msi_supported = true, 642 642 }; 643 643 644 - static struct ngene_info ngene_info_satixS2v2 = { 644 + static const struct ngene_info ngene_info_satixS2v2 = { 645 645 .type = NGENE_SIDEWINDER, 646 646 .name = "Mystique SaTiX-S2 Dual (v2)", 647 647 .io_type = {NGENE_IO_TSIN, NGENE_IO_TSIN, NGENE_IO_TSIN, NGENE_IO_TSIN, ··· 656 656 .msi_supported = true, 657 657 }; 658 658 659 - static struct ngene_info ngene_info_cineS2v5 = { 659 + static const struct ngene_info ngene_info_cineS2v5 = { 660 660 .type = NGENE_SIDEWINDER, 661 661 .name = "Linux4Media cineS2 DVB-S2 Twin Tuner (v5)", 662 662 .io_type = {NGENE_IO_TSIN, NGENE_IO_TSIN, NGENE_IO_TSIN, NGENE_IO_TSIN, ··· 672 672 }; 673 673 674 674 675 - static struct ngene_info ngene_info_duoFlex = { 675 + static const struct ngene_info ngene_info_duoFlex = { 676 676 .type = NGENE_SIDEWINDER, 677 677 .name = "Digital Devices DuoFlex PCIe or miniPCIe", 678 678 .io_type = {NGENE_IO_TSIN, NGENE_IO_TSIN, NGENE_IO_TSIN, NGENE_IO_TSIN, ··· 687 687 .msi_supported = true, 688 688 }; 689 689 690 - static struct ngene_info ngene_info_m780 = { 690 + static const struct ngene_info ngene_info_m780 = { 691 691 .type = NGENE_APP, 692 692 .name = "Aver M780 ATSC/QAM-B", 693 693 ··· 727 727 .osc_deviation = osc_deviation, 728 728 }; 729 729 730 - static struct ngene_info ngene_info_terratec = { 730 + static const struct ngene_info ngene_info_terratec = { 731 731 .type = NGENE_TERRATEC, 732 732 .name = "Terratec Integra/Cinergy2400i Dual DVB-T", 733 733 .io_type = {NGENE_IO_TSIN, NGENE_IO_TSIN},
+4 -4
drivers/media/pci/smipcie/smipcie-main.c
··· 1060 1060 } 1061 1061 1062 1062 /* DVBSky cards */ 1063 - static struct smi_cfg_info dvbsky_s950_cfg = { 1063 + static const struct smi_cfg_info dvbsky_s950_cfg = { 1064 1064 .type = SMI_DVBSKY_S950, 1065 1065 .name = "DVBSky S950 V3", 1066 1066 .ts_0 = SMI_TS_NULL, ··· 1070 1070 .rc_map = RC_MAP_DVBSKY, 1071 1071 }; 1072 1072 1073 - static struct smi_cfg_info dvbsky_s952_cfg = { 1073 + static const struct smi_cfg_info dvbsky_s952_cfg = { 1074 1074 .type = SMI_DVBSKY_S952, 1075 1075 .name = "DVBSky S952 V3", 1076 1076 .ts_0 = SMI_TS_DMA_BOTH, ··· 1080 1080 .rc_map = RC_MAP_DVBSKY, 1081 1081 }; 1082 1082 1083 - static struct smi_cfg_info dvbsky_t9580_cfg = { 1083 + static const struct smi_cfg_info dvbsky_t9580_cfg = { 1084 1084 .type = SMI_DVBSKY_T9580, 1085 1085 .name = "DVBSky T9580 V3", 1086 1086 .ts_0 = SMI_TS_DMA_BOTH, ··· 1090 1090 .rc_map = RC_MAP_DVBSKY, 1091 1091 }; 1092 1092 1093 - static struct smi_cfg_info technotrend_s2_4200_cfg = { 1093 + static const struct smi_cfg_info technotrend_s2_4200_cfg = { 1094 1094 .type = SMI_TECHNOTREND_S2_4200, 1095 1095 .name = "TechnoTrend TT-budget S2-4200 Twin", 1096 1096 .ts_0 = SMI_TS_DMA_BOTH,