Commit c79cc3d5 authored by Rikard Falkeborn's avatar Rikard Falkeborn Committed by Kishon Vijay Abraham I

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: default avatarRikard Falkeborn <rikard.falkeborn@gmail.com>
Link: https://lore.kernel.org/r/20200516120441.7627-4-rikard.falkeborn@gmail.comSigned-off-by: default avatarKishon Vijay Abraham I <kishon@ti.com>
parent cbe72af1
...@@ -39,14 +39,14 @@ struct match_chip_info { ...@@ -39,14 +39,14 @@ struct match_chip_info {
u8 optional_reg; u8 optional_reg;
}; };
static struct value_to_name_map brcm_dr_mode_to_name[] = { static const struct value_to_name_map brcm_dr_mode_to_name[] = {
{ USB_CTLR_MODE_HOST, "host" }, { USB_CTLR_MODE_HOST, "host" },
{ USB_CTLR_MODE_DEVICE, "peripheral" }, { USB_CTLR_MODE_DEVICE, "peripheral" },
{ USB_CTLR_MODE_DRD, "drd" }, { USB_CTLR_MODE_DRD, "drd" },
{ USB_CTLR_MODE_TYPEC_PD, "typec-pd" } { USB_CTLR_MODE_TYPEC_PD, "typec-pd" }
}; };
static struct value_to_name_map brcm_dual_mode_to_name[] = { static const struct value_to_name_map brcm_dual_mode_to_name[] = {
{ 0, "host" }, { 0, "host" },
{ 1, "device" }, { 1, "device" },
{ 2, "auto" }, { 2, "auto" },
...@@ -138,7 +138,7 @@ static int brcm_usb_phy_exit(struct phy *gphy) ...@@ -138,7 +138,7 @@ static int brcm_usb_phy_exit(struct phy *gphy)
return 0; return 0;
} }
static struct phy_ops brcm_usb_phy_ops = { static const struct phy_ops brcm_usb_phy_ops = {
.init = brcm_usb_phy_init, .init = brcm_usb_phy_init,
.exit = brcm_usb_phy_exit, .exit = brcm_usb_phy_exit,
.owner = THIS_MODULE, .owner = THIS_MODULE,
...@@ -170,7 +170,7 @@ static struct phy *brcm_usb_phy_xlate(struct device *dev, ...@@ -170,7 +170,7 @@ static struct phy *brcm_usb_phy_xlate(struct device *dev,
return ERR_PTR(-ENODEV); return ERR_PTR(-ENODEV);
} }
static int name_to_value(struct value_to_name_map *table, int count, static int name_to_value(const struct value_to_name_map *table, int count,
const char *name, int *value) const char *name, int *value)
{ {
int x; int x;
...@@ -185,7 +185,7 @@ static int name_to_value(struct value_to_name_map *table, int count, ...@@ -185,7 +185,7 @@ static int name_to_value(struct value_to_name_map *table, int count,
return -EINVAL; return -EINVAL;
} }
static const char *value_to_name(struct value_to_name_map *table, int count, static const char *value_to_name(const struct value_to_name_map *table, int count,
int value) int value)
{ {
if (value >= count) if (value >= count)
...@@ -252,7 +252,7 @@ static const struct attribute_group brcm_usb_phy_group = { ...@@ -252,7 +252,7 @@ static const struct attribute_group brcm_usb_phy_group = {
.attrs = brcm_usb_phy_attrs, .attrs = brcm_usb_phy_attrs,
}; };
static struct match_chip_info chip_info_7216 = { static const struct match_chip_info chip_info_7216 = {
.init_func = &brcm_usb_dvr_init_7216, .init_func = &brcm_usb_dvr_init_7216,
.required_regs = { .required_regs = {
BRCM_REGS_CTRL, BRCM_REGS_CTRL,
...@@ -262,7 +262,7 @@ static struct match_chip_info chip_info_7216 = { ...@@ -262,7 +262,7 @@ static struct match_chip_info chip_info_7216 = {
}, },
}; };
static struct match_chip_info chip_info_7211b0 = { static const struct match_chip_info chip_info_7211b0 = {
.init_func = &brcm_usb_dvr_init_7211b0, .init_func = &brcm_usb_dvr_init_7211b0,
.required_regs = { .required_regs = {
BRCM_REGS_CTRL, BRCM_REGS_CTRL,
...@@ -275,7 +275,7 @@ static struct match_chip_info chip_info_7211b0 = { ...@@ -275,7 +275,7 @@ static struct match_chip_info chip_info_7211b0 = {
.optional_reg = BRCM_REGS_BDC_EC, .optional_reg = BRCM_REGS_BDC_EC,
}; };
static struct match_chip_info chip_info_7445 = { static const struct match_chip_info chip_info_7445 = {
.init_func = &brcm_usb_dvr_init_7445, .init_func = &brcm_usb_dvr_init_7445,
.required_regs = { .required_regs = {
BRCM_REGS_CTRL, BRCM_REGS_CTRL,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment