Re: [PATCH v2] drm/panel/synaptics-r63353: Use _multi variants

From: Doug Anderson
Date: Wed Mar 12 2025 - 20:22:09 EST


Hi,

On Wed, Mar 12, 2025 at 5:00 PM Anusha Srivatsa <asrivats@xxxxxxxxxx> wrote:
>
>
>
> On Wed, Mar 12, 2025 at 11:48 AM Doug Anderson <dianders@xxxxxxxxxxxx> wrote:
>>
>> Hi,
>>
>> On Wed, Mar 12, 2025 at 8:06 AM Anusha Srivatsa <asrivats@xxxxxxxxxx> wrote:
>> >
>> >> > @@ -106,53 +107,46 @@ static int r63353_panel_power_off(struct r63353_panel *rpanel)
>> >> > static int r63353_panel_activate(struct r63353_panel *rpanel)
>> >> > {
>> >> > struct mipi_dsi_device *dsi = rpanel->dsi;
>> >> > - struct device *dev = &dsi->dev;
>> >> > - int i, ret;
>> >> > + struct mipi_dsi_multi_context dsi_ctx = { .dsi = dsi };
>> >> > + int i;
>> >> >
>> >> > - ret = mipi_dsi_dcs_soft_reset(dsi);
>> >> > - if (ret < 0) {
>> >> > - dev_err(dev, "Failed to do Software Reset (%d)\n", ret);
>> >> > + mipi_dsi_dcs_soft_reset_multi(&dsi_ctx);
>> >> > + if (dsi_ctx.accum_err)
>> >> > goto fail;
>> >> > - }
>> >>
>> >> This changes was definitely not what the script is doing.
>> >
>> >
>> > 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.
>>
>> ...and now you're getting to see why I didn't think a coccinelle
>> script could fully handle this task. ;-) IMO instead of trying to get
>> a coccinelle script to do the full conversion, the right approach
>> would be to use a coccinelle script (or equivalent) to get the basics
>> done (just so you don't make any typos) and then cleanup the result
>> manually. Spending more time on the coccinelle script than it would
>> take to do the conversion manually is probably not the right approach.
>>
>> If your patch wasn't fully generated by a coccinelle script you should
>> document that in the commit message. Something like "Initial patch was
>> generated by a coccinelle script and the result was cleaned up
>> manually." If the script is too long to fit in the commit message,
>> it's fine to put it somewhere online and provide a link. "Somewhere
>> online" could easily be a mailing list post.
>>
>
> You know I have been thinking if it makes sense to have this script merged to coccinelle project and add those details in the commit log.... Was having an offline discussion with @Maxime Ripard today and he rightly pointed out that since it is too specific, once all the conversions are done , the script would not be further useable....
> About having the script online and providing a link, something link a github link?

That feels overkill. It seems like you could just send an email to
LKML or dri-devel and then link it that way. It could be in reply to
this thread or a totally separate email. lore.kernel.org links are
great.

-Doug