* [PATCH] usb: phy: tegra: embed UTMI pad config in phy struct
@ 2026-09-21 1:59 Rosen Penev
2026-11-20 12:40 ` Greg Kroah-Hartman
0 siblings, 1 reply; 2+ messages in thread
From: Rosen Penev @ 2026-09-21 1:59 UTC (permalink / raw)
To: linux-usb
Cc: Greg Kroah-Hartman, Thierry Reding, Jonathan Hunter,
open list:TEGRA ARCHITECTURE SUPPORT, open list
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@gmail.com>
---
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
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH] usb: phy: tegra: embed UTMI pad config in phy struct
2026-09-21 1:59 [PATCH] usb: phy: tegra: embed UTMI pad config in phy struct Rosen Penev
@ 2026-11-20 12:40 ` Greg Kroah-Hartman
0 siblings, 0 replies; 2+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-20 12:40 UTC (permalink / raw)
To: Rosen Penev
Cc: linux-usb, Thierry Reding, Jonathan Hunter,
open list:TEGRA ARCHITECTURE SUPPORT, open list
On Sun, Sep 20, 2026 at 06:59:52PM -0700, Rosen Penev wrote:
> 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.
But why is this needed? What does this "fix"?
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-20 12:40 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-21 1:59 [PATCH] usb: phy: tegra: embed UTMI pad config in phy struct Rosen Penev
2026-11-20 12:40 ` Greg Kroah-Hartman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®