<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">On Tue, Mar 11, 2025 at 3:31 AM Maxime Ripard <<a href="mailto:mripard@kernel.org">mripard@kernel.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Mon, Mar 10, 2025 at 04:58:22PM -0400, Anusha Srivatsa wrote:<br>
> Move away from using deprecated API and use _multi<br>
> variants if available. Use mipi_dsi_msleep()<br>
> and mipi_dsi_usleep_range() instead of msleep()<br>
> and usleep_range() respectively.<br>
> <br>
> Used Coccinelle to find the multiple occurences.<br>
> SmPl patch:<br>
> @rule@<br>
> identifier dsi_var;<br>
> identifier r;<br>
> identifier func;<br>
> type t;<br>
> position p;<br>
> expression dsi_device;<br>
> expression list es;<br>
> @@<br>
> t func(...) {<br>
> ...<br>
> struct mipi_dsi_device *dsi_var = dsi_device;<br>
> +struct mipi_dsi_multi_context dsi_ctx = { .dsi = dsi_var };<br>
> <+...<br>
> (<br>
> -mipi_dsi_dcs_write_seq(dsi_var,es)@p;<br>
> +mipi_dsi_dcs_write_seq_multi(&dsi_ctx,es);<br>
> |<br>
> -mipi_dsi_generic_write_seq(dsi_var,es)@p;<br>
> +mipi_dsi_generic_write_seq_multi(&dsi_ctx,es);<br>
> |<br>
> -mipi_dsi_generic_write(dsi_var,es)@p;<br>
> +mipi_dsi_generic_write_multi(&dsi_ctx,es);<br>
> |<br>
> -r = mipi_dsi_dcs_nop(dsi_var)@p;<br>
> +mipi_dsi_dcs_nop_multi(&dsi_ctx);<br>
> |<br>
> ....rest of API<br>
> ..<br>
> )<br>
> -if(r < 0) {<br>
> -...<br>
> -}<br>
> ...+><br>
<br>
Again, you need to provide the full coccinelle script here otherwise<br>
it's useless. And I have serious doubts that it's actually the script<br>
you used, because ...<br>
<br></blockquote><div><br></div><div>I had another rule just for msleeps and usleep(). The commit msg is getting too big with just the script. But yes, here you go:</div>@rule_4@<br>identifier dsi_var;<br>identifier r;<br>identifier func;<br>type t;<br>position p;<br>expression dsi_device;<br>expression list es;<br>@@<br>t func(...) {<br>...<br>struct mipi_dsi_device *dsi_var = dsi_device;<br>+struct mipi_dsi_multi_context dsi_ctx = { .dsi = dsi_var };<br><+...<br>(<br>-r = msleep(es)@p;<br>+r = mipi_dsi_msleep(&dsi_ctx,es);<br>|<br>-msleep(es)@p;<br>+mipi_dsi_msleep(&dsi_ctx,es);<br>|<br>-r = usleep_range(es)@p;<br>+r = mipi_dsi_usleep_range(&dsi_ctx,es);<br>|<br>-usleep_range(es)@p;<br>+mipi_dsi_usleep_range(&dsi_ctx,es);<br>)<br>...+><br>}<br><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
> @@ -106,53 +107,46 @@ static int r63353_panel_power_off(struct r63353_panel *rpanel)<br>
> static int r63353_panel_activate(struct r63353_panel *rpanel)<br>
> {<br>
> struct mipi_dsi_device *dsi = rpanel->dsi;<br>
> - struct device *dev = &dsi->dev;<br>
> - int i, ret;<br>
> + struct mipi_dsi_multi_context dsi_ctx = { .dsi = dsi };<br>
> + int i;<br>
> <br>
> - ret = mipi_dsi_dcs_soft_reset(dsi);<br>
> - if (ret < 0) {<br>
> - dev_err(dev, "Failed to do Software Reset (%d)\n", ret);<br>
> + mipi_dsi_dcs_soft_reset_multi(&dsi_ctx);<br>
> + if (dsi_ctx.accum_err)<br>
> goto fail;<br>
> - }<br>
<br>
This changes was definitely not what the script is doing.<br></blockquote><div><br></div><div>It isnt. Using coccinelle for the major part of pattern matching and replacing the newer _multi variant API. Some handling (including a newline that it introduces) and the returns depend on a case by case basis, which had to be done manually.</div><div><br></div><div>Anusha</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
Maxime<br>
</blockquote></div></div>