* [PATCH 0/3] phy: broadcom: Constify structs
@ 2020-05-16 12:04 Rikard Falkeborn
2020-05-16 12:04 ` [PATCH 1/3] phy: phy-bcm-ns2-usbdrd: Constify phy_ops Rikard Falkeborn
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Rikard Falkeborn @ 2020-05-16 12:04 UTC (permalink / raw)
To: kishon, vkoul, alcooperx
Cc: linux-kernel, bcm-kernel-feedback-list, Rikard Falkeborn
A small series adding const to a few static structs. Each patch can be
applied separately.
Rikard Falkeborn (3):
phy: phy-bcm-ns2-usbdrd: Constify phy_ops
phy: sr-usb: Constify phy_ops
phy: phy-brcm-usb: Constify static structs
drivers/phy/broadcom/phy-bcm-ns2-usbdrd.c | 2 +-
drivers/phy/broadcom/phy-bcm-sr-usb.c | 2 +-
drivers/phy/broadcom/phy-brcm-usb.c | 16 ++++++++--------
3 files changed, 10 insertions(+), 10 deletions(-)
--
2.26.2
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/3] phy: phy-bcm-ns2-usbdrd: Constify phy_ops
2020-05-16 12:04 [PATCH 0/3] phy: broadcom: Constify structs Rikard Falkeborn
@ 2020-05-16 12:04 ` Rikard Falkeborn
2020-05-16 12:04 ` [PATCH 2/3] phy: sr-usb: " Rikard Falkeborn
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Rikard Falkeborn @ 2020-05-16 12:04 UTC (permalink / raw)
To: kishon, vkoul, alcooperx
Cc: linux-kernel, bcm-kernel-feedback-list, Rikard Falkeborn
phy_ops are never modified and can therefore be made const to allow the
compiler to put it in read-only memory.
Before:
text data bss dec hex filename
7831 3144 128 11103 2b5f drivers/phy/broadcom/phy-bcm-ns2-usbdrd.o
After:
text data bss dec hex filename
7959 3016 128 11103 2b5f drivers/phy/broadcom/phy-bcm-ns2-usbdrd.o
Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
---
drivers/phy/broadcom/phy-bcm-ns2-usbdrd.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/phy/broadcom/phy-bcm-ns2-usbdrd.c b/drivers/phy/broadcom/phy-bcm-ns2-usbdrd.c
index 7ceea5ae2704..527625912b78 100644
--- a/drivers/phy/broadcom/phy-bcm-ns2-usbdrd.c
+++ b/drivers/phy/broadcom/phy-bcm-ns2-usbdrd.c
@@ -279,7 +279,7 @@ static irqreturn_t gpio_irq_handler(int irq, void *dev_id)
return IRQ_HANDLED;
}
-static struct phy_ops ops = {
+static const struct phy_ops ops = {
.init = ns2_drd_phy_init,
.power_on = ns2_drd_phy_poweron,
.power_off = ns2_drd_phy_poweroff,
--
2.26.2
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/3] phy: sr-usb: Constify phy_ops
2020-05-16 12:04 [PATCH 0/3] phy: broadcom: Constify structs Rikard Falkeborn
2020-05-16 12:04 ` [PATCH 1/3] phy: phy-bcm-ns2-usbdrd: Constify phy_ops Rikard Falkeborn
@ 2020-05-16 12:04 ` Rikard Falkeborn
2020-05-16 12:04 ` [PATCH 3/3] phy: phy-brcm-usb: Constify static structs Rikard Falkeborn
2020-05-18 12:14 ` [PATCH 0/3] phy: broadcom: Constify structs Kishon Vijay Abraham I
3 siblings, 0 replies; 5+ messages in thread
From: Rikard Falkeborn @ 2020-05-16 12:04 UTC (permalink / raw)
To: kishon, vkoul, alcooperx
Cc: linux-kernel, bcm-kernel-feedback-list, Rikard Falkeborn
phy_ops are never modified and can therefore be made const to allow the
compiler to put it in read-only memory.
Before:
text data bss dec hex filename
4310 1244 0 5554 15b2 drivers/phy/broadcom/phy-bcm-sr-usb.o
After:
text data bss dec hex filename
4438 1116 0 5554 15b2 drivers/phy/broadcom/phy-bcm-sr-usb.o
Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
---
drivers/phy/broadcom/phy-bcm-sr-usb.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/phy/broadcom/phy-bcm-sr-usb.c b/drivers/phy/broadcom/phy-bcm-sr-usb.c
index fe6c58910e4c..e04be8f52744 100644
--- a/drivers/phy/broadcom/phy-bcm-sr-usb.c
+++ b/drivers/phy/broadcom/phy-bcm-sr-usb.c
@@ -256,7 +256,7 @@ static int bcm_usb_phy_init(struct phy *phy)
return ret;
}
-static struct phy_ops sr_phy_ops = {
+static const struct phy_ops sr_phy_ops = {
.init = bcm_usb_phy_init,
.reset = bcm_usb_phy_reset,
.owner = THIS_MODULE,
--
2.26.2
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 3/3] phy: phy-brcm-usb: Constify static structs
2020-05-16 12:04 [PATCH 0/3] phy: broadcom: Constify structs Rikard Falkeborn
2020-05-16 12:04 ` [PATCH 1/3] phy: phy-bcm-ns2-usbdrd: Constify phy_ops Rikard Falkeborn
2020-05-16 12:04 ` [PATCH 2/3] phy: sr-usb: " Rikard Falkeborn
@ 2020-05-16 12:04 ` Rikard Falkeborn
2020-05-18 12:14 ` [PATCH 0/3] phy: broadcom: Constify structs Kishon Vijay Abraham I
3 siblings, 0 replies; 5+ messages in thread
From: Rikard Falkeborn @ 2020-05-16 12:04 UTC (permalink / raw)
To: kishon, vkoul, alcooperx
Cc: linux-kernel, bcm-kernel-feedback-list, Rikard Falkeborn
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>
---
drivers/phy/broadcom/phy-brcm-usb.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/drivers/phy/broadcom/phy-brcm-usb.c b/drivers/phy/broadcom/phy-brcm-usb.c
index 491bbd46c5b3..99fbc7e4138b 100644
--- a/drivers/phy/broadcom/phy-brcm-usb.c
+++ b/drivers/phy/broadcom/phy-brcm-usb.c
@@ -39,14 +39,14 @@ struct match_chip_info {
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_DEVICE, "peripheral" },
{ USB_CTLR_MODE_DRD, "drd" },
{ 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" },
{ 1, "device" },
{ 2, "auto" },
@@ -138,7 +138,7 @@ static int brcm_usb_phy_exit(struct phy *gphy)
return 0;
}
-static struct phy_ops brcm_usb_phy_ops = {
+static const struct phy_ops brcm_usb_phy_ops = {
.init = brcm_usb_phy_init,
.exit = brcm_usb_phy_exit,
.owner = THIS_MODULE,
@@ -170,7 +170,7 @@ static struct phy *brcm_usb_phy_xlate(struct device *dev,
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)
{
int x;
@@ -185,7 +185,7 @@ static int name_to_value(struct value_to_name_map *table, int count,
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)
{
if (value >= count)
@@ -252,7 +252,7 @@ static const struct attribute_group brcm_usb_phy_group = {
.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,
.required_regs = {
BRCM_REGS_CTRL,
@@ -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,
.required_regs = {
BRCM_REGS_CTRL,
@@ -275,7 +275,7 @@ static struct match_chip_info chip_info_7211b0 = {
.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,
.required_regs = {
BRCM_REGS_CTRL,
--
2.26.2
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 0/3] phy: broadcom: Constify structs
2020-05-16 12:04 [PATCH 0/3] phy: broadcom: Constify structs Rikard Falkeborn
` (2 preceding siblings ...)
2020-05-16 12:04 ` [PATCH 3/3] phy: phy-brcm-usb: Constify static structs Rikard Falkeborn
@ 2020-05-18 12:14 ` Kishon Vijay Abraham I
3 siblings, 0 replies; 5+ messages in thread
From: Kishon Vijay Abraham I @ 2020-05-18 12:14 UTC (permalink / raw)
To: Rikard Falkeborn, vkoul, alcooperx; +Cc: linux-kernel, bcm-kernel-feedback-list
On 5/16/2020 5:34 PM, Rikard Falkeborn wrote:
> A small series adding const to a few static structs. Each patch can be
> applied separately.
merged, thanks!
-Kishon
>
> Rikard Falkeborn (3):
> phy: phy-bcm-ns2-usbdrd: Constify phy_ops
> phy: sr-usb: Constify phy_ops
> phy: phy-brcm-usb: Constify static structs
>
> drivers/phy/broadcom/phy-bcm-ns2-usbdrd.c | 2 +-
> drivers/phy/broadcom/phy-bcm-sr-usb.c | 2 +-
> drivers/phy/broadcom/phy-brcm-usb.c | 16 ++++++++--------
> 3 files changed, 10 insertions(+), 10 deletions(-)
>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-05-18 12:14 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-16 12:04 [PATCH 0/3] phy: broadcom: Constify structs Rikard Falkeborn
2020-05-16 12:04 ` [PATCH 1/3] phy: phy-bcm-ns2-usbdrd: Constify phy_ops Rikard Falkeborn
2020-05-16 12:04 ` [PATCH 2/3] phy: sr-usb: " Rikard Falkeborn
2020-05-16 12:04 ` [PATCH 3/3] phy: phy-brcm-usb: Constify static structs Rikard Falkeborn
2020-05-18 12:14 ` [PATCH 0/3] phy: broadcom: Constify structs Kishon Vijay Abraham I
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).