Skip to content

Commit 1d7eb11

Browse files
tititiou36vinodkoul
authored andcommitted
phy: cadence-torrent: Constify struct cdns_torrent_vals_entry
'struct cdns_torrent_vals_entry' is not modified in this driver. Constifying this structure moves some data to a read-only section, so increase overall security. On a x86_64, with allmodconfig: Before: ====== text data bss dec hex filename 85130 13214 16 98360 18038 drivers/phy/cadence/phy-cadence-torrent.o After: ===== text data bss dec hex filename 92234 6078 16 98328 18018 drivers/phy/cadence/phy-cadence-torrent.o Signed-off-by: Christophe JAILLET <[email protected]> Link: https://lore.kernel.org/r/dcc4e539999a840b3fd8f40fd8fd7523390232ac.1720718240.git.christophe.jaillet@wanadoo.fr Signed-off-by: Vinod Koul <[email protected]>
1 parent ad36548 commit 1d7eb11

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

drivers/phy/cadence/phy-cadence-torrent.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ struct cdns_torrent_vals_entry {
432432
};
433433

434434
struct cdns_torrent_vals_table {
435-
struct cdns_torrent_vals_entry *entries;
435+
const struct cdns_torrent_vals_entry *entries;
436436
u32 num_entries;
437437
};
438438

@@ -4611,7 +4611,7 @@ static struct cdns_torrent_vals pcie_100_no_ssc_rx_ln_vals = {
46114611
.num_regs = ARRAY_SIZE(pcie_100_ext_no_ssc_rx_ln_regs),
46124612
};
46134613

4614-
static struct cdns_torrent_vals_entry link_cmn_vals_entries[] = {
4614+
static const struct cdns_torrent_vals_entry link_cmn_vals_entries[] = {
46154615
{CDNS_TORRENT_KEY_ANYCLK(TYPE_DP, TYPE_NONE), &sl_dp_link_cmn_vals},
46164616
{CDNS_TORRENT_KEY_ANYCLK(TYPE_DP, TYPE_PCIE), &pcie_dp_link_cmn_vals},
46174617
{CDNS_TORRENT_KEY_ANYCLK(TYPE_DP, TYPE_USB), &usb_dp_link_cmn_vals},
@@ -4647,7 +4647,7 @@ static struct cdns_torrent_vals_entry link_cmn_vals_entries[] = {
46474647
{CDNS_TORRENT_KEY_ANYCLK(TYPE_USXGMII, TYPE_QSGMII), &usxgmii_sgmii_link_cmn_vals},
46484648
};
46494649

4650-
static struct cdns_torrent_vals_entry xcvr_diag_vals_entries[] = {
4650+
static const struct cdns_torrent_vals_entry xcvr_diag_vals_entries[] = {
46514651
{CDNS_TORRENT_KEY_ANYCLK(TYPE_DP, TYPE_NONE), &sl_dp_xcvr_diag_ln_vals},
46524652
{CDNS_TORRENT_KEY_ANYCLK(TYPE_DP, TYPE_PCIE), &dp_pcie_xcvr_diag_ln_vals},
46534653
{CDNS_TORRENT_KEY_ANYCLK(TYPE_DP, TYPE_USB), &dp_usb_xcvr_diag_ln_vals},
@@ -4683,15 +4683,15 @@ static struct cdns_torrent_vals_entry xcvr_diag_vals_entries[] = {
46834683
{CDNS_TORRENT_KEY_ANYCLK(TYPE_USXGMII, TYPE_QSGMII), &usxgmii_sgmii_xcvr_diag_ln_vals},
46844684
};
46854685

4686-
static struct cdns_torrent_vals_entry pcs_cmn_vals_entries[] = {
4686+
static const struct cdns_torrent_vals_entry pcs_cmn_vals_entries[] = {
46874687
{CDNS_TORRENT_KEY_ANYCLK(TYPE_USB, TYPE_NONE), &usb_phy_pcs_cmn_vals},
46884688
{CDNS_TORRENT_KEY_ANYCLK(TYPE_USB, TYPE_PCIE), &usb_phy_pcs_cmn_vals},
46894689
{CDNS_TORRENT_KEY_ANYCLK(TYPE_USB, TYPE_SGMII), &usb_phy_pcs_cmn_vals},
46904690
{CDNS_TORRENT_KEY_ANYCLK(TYPE_USB, TYPE_QSGMII), &usb_phy_pcs_cmn_vals},
46914691
{CDNS_TORRENT_KEY_ANYCLK(TYPE_USB, TYPE_DP), &usb_phy_pcs_cmn_vals},
46924692
};
46934693

4694-
static struct cdns_torrent_vals_entry cmn_vals_entries[] = {
4694+
static const struct cdns_torrent_vals_entry cmn_vals_entries[] = {
46954695
{CDNS_TORRENT_KEY(CLK_19_2_MHZ, CLK_19_2_MHZ, TYPE_DP, TYPE_NONE, NO_SSC), &sl_dp_19_2_no_ssc_cmn_vals},
46964696
{CDNS_TORRENT_KEY(CLK_25_MHZ, CLK_25_MHZ, TYPE_DP, TYPE_NONE, NO_SSC), &sl_dp_25_no_ssc_cmn_vals},
46974697

@@ -4773,7 +4773,7 @@ static struct cdns_torrent_vals_entry cmn_vals_entries[] = {
47734773
{CDNS_TORRENT_KEY(CLK_156_25_MHZ, CLK_100_MHZ, TYPE_USXGMII, TYPE_QSGMII, NO_SSC), &ml_usxgmii_pll0_156_25_no_ssc_cmn_vals},
47744774
};
47754775

4776-
static struct cdns_torrent_vals_entry cdns_tx_ln_vals_entries[] = {
4776+
static const struct cdns_torrent_vals_entry cdns_tx_ln_vals_entries[] = {
47774777
{CDNS_TORRENT_KEY(CLK_19_2_MHZ, CLK_19_2_MHZ, TYPE_DP, TYPE_NONE, NO_SSC), &sl_dp_19_2_no_ssc_tx_ln_vals},
47784778
{CDNS_TORRENT_KEY(CLK_25_MHZ, CLK_25_MHZ, TYPE_DP, TYPE_NONE, NO_SSC), &sl_dp_25_no_ssc_tx_ln_vals},
47794779

@@ -4855,7 +4855,7 @@ static struct cdns_torrent_vals_entry cdns_tx_ln_vals_entries[] = {
48554855
{CDNS_TORRENT_KEY(CLK_156_25_MHZ, CLK_100_MHZ, TYPE_USXGMII, TYPE_QSGMII, NO_SSC), &ml_usxgmii_156_25_no_ssc_tx_ln_vals},
48564856
};
48574857

4858-
static struct cdns_torrent_vals_entry cdns_rx_ln_vals_entries[] = {
4858+
static const struct cdns_torrent_vals_entry cdns_rx_ln_vals_entries[] = {
48594859
{CDNS_TORRENT_KEY(CLK_19_2_MHZ, CLK_19_2_MHZ, TYPE_DP, TYPE_NONE, NO_SSC), &sl_dp_19_2_no_ssc_rx_ln_vals},
48604860
{CDNS_TORRENT_KEY(CLK_25_MHZ, CLK_25_MHZ, TYPE_DP, TYPE_NONE, NO_SSC), &sl_dp_25_no_ssc_rx_ln_vals},
48614861

@@ -4966,14 +4966,14 @@ static const struct cdns_torrent_data cdns_map_torrent = {
49664966
},
49674967
};
49684968

4969-
static struct cdns_torrent_vals_entry j721e_phy_pma_cmn_vals_entries[] = {
4969+
static const struct cdns_torrent_vals_entry j721e_phy_pma_cmn_vals_entries[] = {
49704970
{CDNS_TORRENT_KEY_ANYCLK(TYPE_USXGMII, TYPE_NONE), &ti_usxgmii_phy_pma_cmn_vals},
49714971
{CDNS_TORRENT_KEY_ANYCLK(TYPE_USXGMII, TYPE_PCIE), &ti_usxgmii_phy_pma_cmn_vals},
49724972
{CDNS_TORRENT_KEY_ANYCLK(TYPE_USXGMII, TYPE_SGMII), &ti_usxgmii_phy_pma_cmn_vals},
49734973
{CDNS_TORRENT_KEY_ANYCLK(TYPE_USXGMII, TYPE_QSGMII), &ti_usxgmii_phy_pma_cmn_vals},
49744974
};
49754975

4976-
static struct cdns_torrent_vals_entry ti_tx_ln_vals_entries[] = {
4976+
static const struct cdns_torrent_vals_entry ti_tx_ln_vals_entries[] = {
49774977
{CDNS_TORRENT_KEY(CLK_19_2_MHZ, CLK_19_2_MHZ, TYPE_DP, TYPE_NONE, NO_SSC), &sl_dp_19_2_no_ssc_tx_ln_vals},
49784978
{CDNS_TORRENT_KEY(CLK_25_MHZ, CLK_25_MHZ, TYPE_DP, TYPE_NONE, NO_SSC), &sl_dp_25_no_ssc_tx_ln_vals},
49794979

@@ -5089,7 +5089,7 @@ static const struct cdns_torrent_data ti_j721e_map_torrent = {
50895089
};
50905090

50915091
/* TI J7200 (Torrent SD0805) */
5092-
static struct cdns_torrent_vals_entry ti_j7200_cmn_vals_entries[] = {
5092+
static const struct cdns_torrent_vals_entry ti_j7200_cmn_vals_entries[] = {
50935093
{CDNS_TORRENT_KEY(CLK_19_2_MHZ, CLK_19_2_MHZ, TYPE_DP, TYPE_NONE, NO_SSC), &sl_dp_19_2_no_ssc_cmn_vals},
50945094
{CDNS_TORRENT_KEY(CLK_25_MHZ, CLK_25_MHZ, TYPE_DP, TYPE_NONE, NO_SSC), &sl_dp_25_no_ssc_cmn_vals},
50955095

@@ -5171,7 +5171,7 @@ static struct cdns_torrent_vals_entry ti_j7200_cmn_vals_entries[] = {
51715171
{CDNS_TORRENT_KEY(CLK_156_25_MHZ, CLK_100_MHZ, TYPE_USXGMII, TYPE_QSGMII, NO_SSC), &j7200_ml_usxgmii_pll0_156_25_no_ssc_cmn_vals},
51725172
};
51735173

5174-
static struct cdns_torrent_vals_entry ti_j7200_tx_ln_vals_entries[] = {
5174+
static const struct cdns_torrent_vals_entry ti_j7200_tx_ln_vals_entries[] = {
51755175
{CDNS_TORRENT_KEY(CLK_19_2_MHZ, CLK_19_2_MHZ, TYPE_DP, TYPE_NONE, NO_SSC), &sl_dp_19_2_no_ssc_tx_ln_vals},
51765176
{CDNS_TORRENT_KEY(CLK_25_MHZ, CLK_25_MHZ, TYPE_DP, TYPE_NONE, NO_SSC), &sl_dp_25_no_ssc_tx_ln_vals},
51775177

@@ -5253,7 +5253,7 @@ static struct cdns_torrent_vals_entry ti_j7200_tx_ln_vals_entries[] = {
52535253
{CDNS_TORRENT_KEY(CLK_156_25_MHZ, CLK_100_MHZ, TYPE_USXGMII, TYPE_QSGMII, NO_SSC), &usxgmii_156_25_no_ssc_tx_ln_vals},
52545254
};
52555255

5256-
static struct cdns_torrent_vals_entry ti_j7200_rx_ln_vals_entries[] = {
5256+
static const struct cdns_torrent_vals_entry ti_j7200_rx_ln_vals_entries[] = {
52575257
{CDNS_TORRENT_KEY(CLK_19_2_MHZ, CLK_19_2_MHZ, TYPE_DP, TYPE_NONE, NO_SSC), &sl_dp_19_2_no_ssc_rx_ln_vals},
52585258
{CDNS_TORRENT_KEY(CLK_25_MHZ, CLK_25_MHZ, TYPE_DP, TYPE_NONE, NO_SSC), &sl_dp_25_no_ssc_rx_ln_vals},
52595259

0 commit comments

Comments
 (0)