linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] drivers/phy/ti: Constify structs
@ 2020-05-24  9:55 Rikard Falkeborn
  2020-05-24  9:55 ` [PATCH 1/2] phy: ti: am654-serdes: Constify regmap_config Rikard Falkeborn
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Rikard Falkeborn @ 2020-05-24  9:55 UTC (permalink / raw)
  To: Kishon Vijay Abraham I, Vinod Koul
  Cc: linux-kernel, Roger Quadros, Rikard Falkeborn, Stephen Boyd,
	Wen Yang, YueHaibing, Jyri Sarha, Wei Yongjun, Sekhar Nori

Constify some static structs that are not modified in order to allow the
compiler to put them in read-only memory.

Rikard Falkeborn (2):
  phy: ti: am654-serdes: Constify regmap_config
  phy: ti: j721e-wiz: Constify structs

 drivers/phy/ti/phy-am654-serdes.c |  2 +-
 drivers/phy/ti/phy-j721e-wiz.c    | 10 +++++-----
 2 files changed, 6 insertions(+), 6 deletions(-)

-- 
2.26.2


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2] phy: ti: am654-serdes: Constify regmap_config
  2020-05-24  9:55 [PATCH 0/2] drivers/phy/ti: Constify structs Rikard Falkeborn
@ 2020-05-24  9:55 ` Rikard Falkeborn
  2020-05-24  9:55 ` [PATCH 2/2] phy: ti: j721e-wiz: Constify structs Rikard Falkeborn
  2020-06-24 12:57 ` [PATCH 0/2] drivers/phy/ti: " Vinod Koul
  2 siblings, 0 replies; 4+ messages in thread
From: Rikard Falkeborn @ 2020-05-24  9:55 UTC (permalink / raw)
  To: Kishon Vijay Abraham I, Vinod Koul
  Cc: linux-kernel, Roger Quadros, Rikard Falkeborn, Stephen Boyd,
	Wen Yang, YueHaibing

regmap_config is not modified and can be made static to allow the compiler
to put it in read-only memory.

Before:
   text    data     bss     dec     hex filename
  12328    3644      64   16036    3ea4 drivers/phy/ti/phy-am654-serdes.o

After:
   text    data     bss     dec     hex filename
  12648    3324      64   16036    3ea4 drivers/phy/ti/phy-am654-serdes.o

Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
---
 drivers/phy/ti/phy-am654-serdes.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/phy/ti/phy-am654-serdes.c b/drivers/phy/ti/phy-am654-serdes.c
index 0a166d5a6414..a174b3c3f010 100644
--- a/drivers/phy/ti/phy-am654-serdes.c
+++ b/drivers/phy/ti/phy-am654-serdes.c
@@ -72,7 +72,7 @@ struct serdes_am654_clk_mux {
 #define to_serdes_am654_clk_mux(_hw)	\
 		container_of(_hw, struct serdes_am654_clk_mux, hw)
 
-static struct regmap_config serdes_am654_regmap_config = {
+static const struct regmap_config serdes_am654_regmap_config = {
 	.reg_bits = 32,
 	.val_bits = 32,
 	.reg_stride = 4,
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2]  phy: ti: j721e-wiz: Constify structs
  2020-05-24  9:55 [PATCH 0/2] drivers/phy/ti: Constify structs Rikard Falkeborn
  2020-05-24  9:55 ` [PATCH 1/2] phy: ti: am654-serdes: Constify regmap_config Rikard Falkeborn
@ 2020-05-24  9:55 ` Rikard Falkeborn
  2020-06-24 12:57 ` [PATCH 0/2] drivers/phy/ti: " Vinod Koul
  2 siblings, 0 replies; 4+ messages in thread
From: Rikard Falkeborn @ 2020-05-24  9:55 UTC (permalink / raw)
  To: Kishon Vijay Abraham I, Vinod Koul
  Cc: linux-kernel, Roger Quadros, Rikard Falkeborn, Jyri Sarha,
	Wei Yongjun, Sekhar Nori

clk_div_table and wiz_regmap_config are not modified and can therefore
be made const to allow the compiler to put them in read-only memory.

Before:
   text    data     bss     dec     hex filename
  20265    7044      64   27373    6aed drivers/phy/ti/phy-j721e-wiz.o

After:
   text    data     bss     dec     hex filename
  20649    6660      64   27373    6aed drivers/phy/ti/phy-j721e-wiz.o

Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
---
 drivers/phy/ti/phy-j721e-wiz.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/phy/ti/phy-j721e-wiz.c b/drivers/phy/ti/phy-j721e-wiz.c
index 30ea5b207285..33c4cf0105a4 100644
--- a/drivers/phy/ti/phy-j721e-wiz.c
+++ b/drivers/phy/ti/phy-j721e-wiz.c
@@ -117,7 +117,7 @@ struct wiz_clk_mux {
 struct wiz_clk_divider {
 	struct clk_hw		hw;
 	struct regmap_field	*field;
-	struct clk_div_table	*table;
+	const struct clk_div_table	*table;
 	struct clk_init_data	clk_data;
 };
 
@@ -131,7 +131,7 @@ struct wiz_clk_mux_sel {
 
 struct wiz_clk_div_sel {
 	struct regmap_field	*field;
-	struct clk_div_table	*table;
+	const struct clk_div_table	*table;
 	const char		*node_name;
 };
 
@@ -173,7 +173,7 @@ static struct wiz_clk_mux_sel clk_mux_sel_10g[] = {
 	},
 };
 
-static struct clk_div_table clk_div_table[] = {
+static const struct clk_div_table clk_div_table[] = {
 	{ .val = 0, .div = 1, },
 	{ .val = 1, .div = 2, },
 	{ .val = 2, .div = 4, },
@@ -559,7 +559,7 @@ static const struct clk_ops wiz_clk_div_ops = {
 
 static int wiz_div_clk_register(struct wiz *wiz, struct device_node *node,
 				struct regmap_field *field,
-				struct clk_div_table *table)
+				const struct clk_div_table *table)
 {
 	struct device *dev = wiz->dev;
 	struct wiz_clk_divider *div;
@@ -756,7 +756,7 @@ static const struct reset_control_ops wiz_phy_reset_ops = {
 	.deassert = wiz_phy_reset_deassert,
 };
 
-static struct regmap_config wiz_regmap_config = {
+static const struct regmap_config wiz_regmap_config = {
 	.reg_bits = 32,
 	.val_bits = 32,
 	.reg_stride = 4,
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 0/2] drivers/phy/ti: Constify structs
  2020-05-24  9:55 [PATCH 0/2] drivers/phy/ti: Constify structs Rikard Falkeborn
  2020-05-24  9:55 ` [PATCH 1/2] phy: ti: am654-serdes: Constify regmap_config Rikard Falkeborn
  2020-05-24  9:55 ` [PATCH 2/2] phy: ti: j721e-wiz: Constify structs Rikard Falkeborn
@ 2020-06-24 12:57 ` Vinod Koul
  2 siblings, 0 replies; 4+ messages in thread
From: Vinod Koul @ 2020-06-24 12:57 UTC (permalink / raw)
  To: Rikard Falkeborn
  Cc: Kishon Vijay Abraham I, linux-kernel, Roger Quadros,
	Stephen Boyd, Wen Yang, YueHaibing, Jyri Sarha, Wei Yongjun,
	Sekhar Nori

On 24-05-20, 11:55, Rikard Falkeborn wrote:
> Constify some static structs that are not modified in order to allow the
> compiler to put them in read-only memory.

Applied both, thanks

-- 
~Vinod

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-06-24 12:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-24  9:55 [PATCH 0/2] drivers/phy/ti: Constify structs Rikard Falkeborn
2020-05-24  9:55 ` [PATCH 1/2] phy: ti: am654-serdes: Constify regmap_config Rikard Falkeborn
2020-05-24  9:55 ` [PATCH 2/2] phy: ti: j721e-wiz: Constify structs Rikard Falkeborn
2020-06-24 12:57 ` [PATCH 0/2] drivers/phy/ti: " Vinod Koul

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).