Skip to contentSkip to conversation

phy: tegra: Constify static device_type structs

PATCH Applied Rikard Falkeborn 2 participants 2 messages Nov 9, 2020 – Nov 16, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 phy: tegra: Constify static device_type structs

The only usage of tegra_xusb_pad_type and tegra_xusb_port_type is to assign their address to the type field in the device struct, which is a const pointer. Make them const to allow the compiler to put them in read-only memory.

---
 drivers/phy/tegra/xusb.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/phy/tegra/xusb.c +2 -2
index ad88d74c1884..70d95519d281 100644
@@ -146,7 +146,7 @@ static void tegra_xusb_pad_release(struct device *dev)
 	pad->soc->ops->remove(pad);
 }
 
-static struct device_type tegra_xusb_pad_type = {
+static const struct device_type tegra_xusb_pad_type = {
 	.release = tegra_xusb_pad_release,
 };
 
@@ -513,7 +513,7 @@ static void tegra_xusb_port_release(struct device *dev)
 		port->ops->release(port);
 }
 
-static struct device_type tegra_xusb_port_type = {
+static const struct device_type tegra_xusb_port_type = {
 	.release = tegra_xusb_port_release,
 };
 
Signature · 1 line
2.29.2
maintainer Applied
#1 lore raw
Quoted 4 lines · Rikard Falkeborn

The only usage of tegra_xusb_pad_type and tegra_xusb_port_type is to assign their address to the type field in the device struct, which is a const pointer. Make them const to allow the compiler to put them in read-only memory.

Applied, thanks

Signature · 1 line
~Vinod