On Mon, Feb 03, 2025 at 11:01:28AM +0100, Maxime Ripard wrote: > Hi Dmitry, > > On Thu, Jan 16, 2025 at 03:08:00AM +0200, Dmitry Baryshkov wrote: > > On Wed, Jan 15, 2025 at 10:05:36PM +0100, Maxime Ripard wrote: > > > The TI sn65dsi86 driver follows the drm_encoder->crtc pointer that is > > > deprecated and shouldn't be used by atomic drivers. > > > > > > This was due to the fact that we did't have any other alternative to > > > retrieve the CRTC pointer. Fortunately, the crtc pointer is now provided > > > in the bridge state, so we can move to atomic callbacks and drop that > > > deprecated pointer usage. > > > > > > Signed-off-by: Maxime Ripard <mripard@xxxxxxxxxx> > > > --- > > > drivers/gpu/drm/bridge/ti-sn65dsi86.c | 41 ++++++++++++++++++++--------------- > > > 1 file changed, 24 insertions(+), 17 deletions(-) > > > > > > diff --git a/drivers/gpu/drm/bridge/ti-sn65dsi86.c b/drivers/gpu/drm/bridge/ti-sn65dsi86.c > > > index b3d617505dda7d22b38c000fb79de46376adf3f1..c17d9486cf5c36d61eb00af2bdf9ba1b6f890ffd 100644 > > > --- a/drivers/gpu/drm/bridge/ti-sn65dsi86.c > > > +++ b/drivers/gpu/drm/bridge/ti-sn65dsi86.c > > > @@ -242,15 +242,16 @@ static void ti_sn65dsi86_write_u16(struct ti_sn65dsi86 *pdata, > > > u8 buf[2] = { val & 0xff, val >> 8 }; > > > > > > regmap_bulk_write(pdata->regmap, reg, buf, ARRAY_SIZE(buf)); > > > } > > > > > > -static u32 ti_sn_bridge_get_dsi_freq(struct ti_sn65dsi86 *pdata) > > > +static u32 ti_sn_bridge_get_dsi_freq(struct ti_sn65dsi86 *pdata, > > > + struct drm_bridge_state *bridge_state) > > > { > > > u32 bit_rate_khz, clk_freq_khz; > > > struct drm_display_mode *mode = > > > - &pdata->bridge.encoder->crtc->state->adjusted_mode; > > > + &bridge_state->crtc->state->adjusted_mode; > > > > At least we should document why is it safe to follow the crtc->state. > > What do you have in mind there? crtc->state is a pointer that is widely > used, what is there to document? If I understand correctly, crtc->state is safe to be used during atomic callbacks only or if the mutex is being held. However this function is also being called from ti_sn65dsi86_enable_comms(), which is in turn is used in ti_sn65dsi86_resume(). Is it safe? Why? -- With best wishes Dmitry