[PATCH 1/3] media: rtl2832: make regmap_config static const

Link Mauve <[email protected]>
Newsgroups gmane.linux.drivers.video-input-infrastructure,gmane.linux.kernel
Message-ID <[email protected]>
This struct was previously carried over in the rtl2832_dev struct, even
though it was used only once at probe-time, using purely static data.

This reduces the size of the rtl2832_dev struct by 192 B, by putting it
in the .rodata section instead.

Signed-off-by: Link Mauve <[email protected]>
---
 drivers/media/dvb-frontends/rtl2832.c      | 18 ++++++++++--------
 drivers/media/dvb-frontends/rtl2832_priv.h |  1 -
 2 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/drivers/media/dvb-frontends/rtl2832.c b/drivers/media/dvb-frontends/rtl2832.c
index b31cdb44b383..6f359036862a 100644
--- a/drivers/media/dvb-frontends/rtl2832.c
+++ b/drivers/media/dvb-frontends/rtl2832.c
@@ -1039,6 +1039,15 @@ static int rtl2832_probe(struct i2c_client *client)
 			.range_max        = 5 * 0x100,
 		},
 	};
+	static const struct regmap_config regmap_config = {
+		.reg_bits	= 8,
+		.val_bits	= 8,
+		.volatile_reg	= rtl2832_volatile_reg,
+		.max_register	= 5 * 0x100,
+		.ranges		= regmap_range_cfg,
+		.num_ranges	= ARRAY_SIZE(regmap_range_cfg),
+		.cache_type	= REGCACHE_NONE,
+	};
 
 	dev_dbg(&client->dev, "\n");
 
@@ -1056,14 +1065,7 @@ static int rtl2832_probe(struct i2c_client *client)
 	dev->sleeping = true;
 	INIT_DELAYED_WORK(&dev->i2c_gate_work, rtl2832_i2c_gate_work);
 	/* create regmap */
-	dev->regmap_config.reg_bits =  8;
-	dev->regmap_config.val_bits =  8;
-	dev->regmap_config.volatile_reg = rtl2832_volatile_reg;
-	dev->regmap_config.max_register = 5 * 0x100;
-	dev->regmap_config.ranges = regmap_range_cfg;
-	dev->regmap_config.num_ranges = ARRAY_SIZE(regmap_range_cfg);
-	dev->regmap_config.cache_type = REGCACHE_NONE;
-	dev->regmap = regmap_init_i2c(client, &dev->regmap_config);
+	dev->regmap = regmap_init_i2c(client, &regmap_config);
 	if (IS_ERR(dev->regmap)) {
 		ret = PTR_ERR(dev->regmap);
 		goto err_kfree;
diff --git a/drivers/media/dvb-frontends/rtl2832_priv.h b/drivers/media/dvb-frontends/rtl2832_priv.h
index f11ba038d5f0..8cf3266e14b0 100644
--- a/drivers/media/dvb-frontends/rtl2832_priv.h
+++ b/drivers/media/dvb-frontends/rtl2832_priv.h
@@ -20,7 +20,6 @@
 struct rtl2832_dev {
 	struct rtl2832_platform_data *pdata;
 	struct i2c_client *client;
-	struct regmap_config regmap_config;
 	struct regmap *regmap;
 	struct i2c_mux_core *muxc;
 	struct dvb_frontend fe;
-- 
2.55.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.