Skip to content

Commit c79cc3d

Browse files
rikardfalkebornkishon
authored andcommitted
phy: phy-brcm-usb: Constify static structs
A number of structs were not modified and can therefore be made const to allow the compiler to put them in read-only memory. In order to do so, update a few functions that don't modify there input to take pointers to const. Before: text data bss dec hex filename 15511 6448 64 22023 5607 drivers/phy/broadcom/phy-brcm-usb.o After: text data bss dec hex filename 16058 5936 64 22058 562a drivers/phy/broadcom/phy-brcm-usb.o Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com> Link: https://lore.kernel.org/r/20200516120441.7627-4-rikard.falkeborn@gmail.com Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
1 parent cbe72af commit c79cc3d

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

‎drivers/phy/broadcom/phy-brcm-usb.c‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,14 @@ struct match_chip_info {
3939
u8 optional_reg;
4040
};
4141

42-
static struct value_to_name_map brcm_dr_mode_to_name[] = {
42+
static const struct value_to_name_map brcm_dr_mode_to_name[] = {
4343
{ USB_CTLR_MODE_HOST, "host" },
4444
{ USB_CTLR_MODE_DEVICE, "peripheral" },
4545
{ USB_CTLR_MODE_DRD, "drd" },
4646
{ USB_CTLR_MODE_TYPEC_PD, "typec-pd" }
4747
};
4848

49-
static struct value_to_name_map brcm_dual_mode_to_name[] = {
49+
static const struct value_to_name_map brcm_dual_mode_to_name[] = {
5050
{ 0, "host" },
5151
{ 1, "device" },
5252
{ 2, "auto" },
@@ -138,7 +138,7 @@ static int brcm_usb_phy_exit(struct phy *gphy)
138138
return 0;
139139
}
140140

141-
static struct phy_ops brcm_usb_phy_ops = {
141+
static const struct phy_ops brcm_usb_phy_ops = {
142142
.init = brcm_usb_phy_init,
143143
.exit = brcm_usb_phy_exit,
144144
.owner = THIS_MODULE,
@@ -170,7 +170,7 @@ static struct phy *brcm_usb_phy_xlate(struct device *dev,
170170
return ERR_PTR(-ENODEV);
171171
}
172172

173-
static int name_to_value(struct value_to_name_map *table, int count,
173+
static int name_to_value(const struct value_to_name_map *table, int count,
174174
const char *name, int *value)
175175
{
176176
int x;
@@ -185,7 +185,7 @@ static int name_to_value(struct value_to_name_map *table, int count,
185185
return -EINVAL;
186186
}
187187

188-
static const char *value_to_name(struct value_to_name_map *table, int count,
188+
static const char *value_to_name(const struct value_to_name_map *table, int count,
189189
int value)
190190
{
191191
if (value >= count)
@@ -252,7 +252,7 @@ static const struct attribute_group brcm_usb_phy_group = {
252252
.attrs = brcm_usb_phy_attrs,
253253
};
254254

255-
static struct match_chip_info chip_info_7216 = {
255+
static const struct match_chip_info chip_info_7216 = {
256256
.init_func = &brcm_usb_dvr_init_7216,
257257
.required_regs = {
258258
BRCM_REGS_CTRL,
@@ -262,7 +262,7 @@ static struct match_chip_info chip_info_7216 = {
262262
},
263263
};
264264

265-
static struct match_chip_info chip_info_7211b0 = {
265+
static const struct match_chip_info chip_info_7211b0 = {
266266
.init_func = &brcm_usb_dvr_init_7211b0,
267267
.required_regs = {
268268
BRCM_REGS_CTRL,
@@ -275,7 +275,7 @@ static struct match_chip_info chip_info_7211b0 = {
275275
.optional_reg = BRCM_REGS_BDC_EC,
276276
};
277277

278-
static struct match_chip_info chip_info_7445 = {
278+
static const struct match_chip_info chip_info_7445 = {
279279
.init_func = &brcm_usb_dvr_init_7445,
280280
.required_regs = {
281281
BRCM_REGS_CTRL,

0 commit comments

Comments
 (0)