[PATCH] usb: phy: tegra: embed UTMI pad config in phy struct
From: Rosen Penev
Date: Sun Sep 20 2026 - 22:00:07 EST
The UTMI pad configuration was kept in a heap-allocated void * member of
struct tegra_usb_phy, even though the driver is the only user of the
field. Embed the struct directly in the phy state to drop the
allocation and the void pointer indirection. The config is
zero-initialized when the phy struct is allocated, so no extra init
is needed.
Assisted-by: LLM
Signed-off-by: Rosen Penev <rosenp@xxxxxxxxx>
---
drivers/usb/phy/phy-tegra-usb.c | 15 ++++-----------
include/linux/usb/tegra_usb_phy.h | 2 +-
2 files changed, 5 insertions(+), 12 deletions(-)
diff --git a/drivers/usb/phy/phy-tegra-usb.c b/drivers/usb/phy/phy-tegra-usb.c
index 00443a7beaeb..12abc99bdf89 100644
--- a/drivers/usb/phy/phy-tegra-usb.c
+++ b/drivers/usb/phy/phy-tegra-usb.c
@@ -392,7 +392,7 @@ static int utmip_pad_close(struct tegra_usb_phy *phy)
static int utmip_pad_power_on(struct tegra_usb_phy *phy)
{
- struct tegra_utmip_config *config = phy->config;
+ struct tegra_utmip_config *config = &phy->config;
void __iomem *base = phy->pad_regs;
u32 val;
int err;
@@ -549,7 +549,7 @@ static void utmi_phy_clk_enable(struct tegra_usb_phy *phy)
static int utmi_phy_power_on(struct tegra_usb_phy *phy)
{
- struct tegra_utmip_config *config = phy->config;
+ struct tegra_utmip_config *config = &phy->config;
void __iomem *base = phy->regs;
u32 val;
int err;
@@ -888,7 +888,7 @@ static void tegra_hsic_writel(struct tegra_usb_phy *phy, u32 reg, u32 value)
static int uhsic_phy_power_on(struct tegra_usb_phy *phy)
{
- struct tegra_utmip_config *config = phy->config;
+ struct tegra_utmip_config *config = &phy->config;
void __iomem *base = phy->regs;
u32 val;
int err = 0;
@@ -1324,7 +1324,7 @@ static int read_utmi_param(struct platform_device *pdev, const char *param,
static int utmi_phy_probe(struct tegra_usb_phy *tegra_phy,
struct platform_device *pdev)
{
- struct tegra_utmip_config *config;
+ struct tegra_utmip_config *config = &tegra_phy->config;
struct resource *res;
int err;
@@ -1345,13 +1345,6 @@ static int utmi_phy_probe(struct tegra_usb_phy *tegra_phy,
return -ENOMEM;
}
- tegra_phy->config = devm_kzalloc(&pdev->dev, sizeof(*config),
- GFP_KERNEL);
- if (!tegra_phy->config)
- return -ENOMEM;
-
- config = tegra_phy->config;
-
err = read_utmi_param(pdev, "nvidia,hssync-start-delay",
&config->hssync_start_delay);
if (err)
diff --git a/include/linux/usb/tegra_usb_phy.h b/include/linux/usb/tegra_usb_phy.h
index 6343f88df5de..953ba9f06c2a 100644
--- a/include/linux/usb/tegra_usb_phy.h
+++ b/include/linux/usb/tegra_usb_phy.h
@@ -76,7 +76,6 @@ struct tegra_usb_phy {
struct regulator *vbus;
struct regmap *pmc_regmap;
enum usb_dr_mode mode;
- void *config;
const struct tegra_phy_soc_config *soc_config;
struct usb_phy *ulpi;
struct usb_phy u_phy;
@@ -87,6 +86,7 @@ struct tegra_usb_phy {
bool wakeup_enabled;
bool pad_wakeup;
bool powered_on;
+ struct tegra_utmip_config config;
};
#endif /* __TEGRA_USB_PHY_H */
--
2.55.0