mediatek: Add support for Xiaomi Redmi Router AX6S
[openwrt/staging/mkresin.git] / target / linux / bcm4908 / patches-5.4 / 085-v5.8-0001-phy-phy-brcm-usb-Constify-static-structs.patch
1 From c79cc3d55c4bf94e9028d6818d449fbdc488eac5 Mon Sep 17 00:00:00 2001
2 From: Rikard Falkeborn <rikard.falkeborn@gmail.com>
3 Date: Sat, 16 May 2020 14:04:41 +0200
4 Subject: [PATCH] phy: phy-brcm-usb: Constify static structs
5
6 A number of structs were not modified and can therefore be made const
7 to allow the compiler to put them in read-only memory.
8
9 In order to do so, update a few functions that don't modify there input
10 to take pointers to const.
11
12 Before:
13 text data bss dec hex filename
14 15511 6448 64 22023 5607 drivers/phy/broadcom/phy-brcm-usb.o
15
16 After:
17 text data bss dec hex filename
18 16058 5936 64 22058 562a drivers/phy/broadcom/phy-brcm-usb.o
19
20 Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
21 Link: https://lore.kernel.org/r/20200516120441.7627-4-rikard.falkeborn@gmail.com
22 Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
23 ---
24 drivers/phy/broadcom/phy-brcm-usb.c | 16 ++++++++--------
25 1 file changed, 8 insertions(+), 8 deletions(-)
26
27 --- a/drivers/phy/broadcom/phy-brcm-usb.c
28 +++ b/drivers/phy/broadcom/phy-brcm-usb.c
29 @@ -39,14 +39,14 @@ struct match_chip_info {
30 u8 optional_reg;
31 };
32
33 -static struct value_to_name_map brcm_dr_mode_to_name[] = {
34 +static const struct value_to_name_map brcm_dr_mode_to_name[] = {
35 { USB_CTLR_MODE_HOST, "host" },
36 { USB_CTLR_MODE_DEVICE, "peripheral" },
37 { USB_CTLR_MODE_DRD, "drd" },
38 { USB_CTLR_MODE_TYPEC_PD, "typec-pd" }
39 };
40
41 -static struct value_to_name_map brcm_dual_mode_to_name[] = {
42 +static const struct value_to_name_map brcm_dual_mode_to_name[] = {
43 { 0, "host" },
44 { 1, "device" },
45 { 2, "auto" },
46 @@ -138,7 +138,7 @@ static int brcm_usb_phy_exit(struct phy
47 return 0;
48 }
49
50 -static struct phy_ops brcm_usb_phy_ops = {
51 +static const struct phy_ops brcm_usb_phy_ops = {
52 .init = brcm_usb_phy_init,
53 .exit = brcm_usb_phy_exit,
54 .owner = THIS_MODULE,
55 @@ -170,7 +170,7 @@ static struct phy *brcm_usb_phy_xlate(st
56 return ERR_PTR(-ENODEV);
57 }
58
59 -static int name_to_value(struct value_to_name_map *table, int count,
60 +static int name_to_value(const struct value_to_name_map *table, int count,
61 const char *name, int *value)
62 {
63 int x;
64 @@ -185,7 +185,7 @@ static int name_to_value(struct value_to
65 return -EINVAL;
66 }
67
68 -static const char *value_to_name(struct value_to_name_map *table, int count,
69 +static const char *value_to_name(const struct value_to_name_map *table, int count,
70 int value)
71 {
72 if (value >= count)
73 @@ -252,7 +252,7 @@ static const struct attribute_group brcm
74 .attrs = brcm_usb_phy_attrs,
75 };
76
77 -static struct match_chip_info chip_info_7216 = {
78 +static const struct match_chip_info chip_info_7216 = {
79 .init_func = &brcm_usb_dvr_init_7216,
80 .required_regs = {
81 BRCM_REGS_CTRL,
82 @@ -262,7 +262,7 @@ static struct match_chip_info chip_info_
83 },
84 };
85
86 -static struct match_chip_info chip_info_7211b0 = {
87 +static const struct match_chip_info chip_info_7211b0 = {
88 .init_func = &brcm_usb_dvr_init_7211b0,
89 .required_regs = {
90 BRCM_REGS_CTRL,
91 @@ -275,7 +275,7 @@ static struct match_chip_info chip_info_
92 .optional_reg = BRCM_REGS_BDC_EC,
93 };
94
95 -static struct match_chip_info chip_info_7445 = {
96 +static const struct match_chip_info chip_info_7445 = {
97 .init_func = &brcm_usb_dvr_init_7445,
98 .required_regs = {
99 BRCM_REGS_CTRL,