Re: [Cocci] SmPL for automatic request_firmware_nowait() conversion

From: SF Markus Elfring
Date: Sat Jun 21 2014 - 02:51:33 EST


> Obviously I considered writing SmPL for this, but one thing which seemed
> hard was that for after the request_firmware_nowait() we tend to tuck
> away into another new call the rest of the code that was in place in the
> original function after the old request_firmware() call. Is there a way
> to dump all that code into the new routine?

Does the refactoring "Extraction of an interface" fit also to your use case?
http://refactoring.com/catalog/extractInterface.html
http://c2.com/cgi/wiki?ExtractInterface


> I think the hardest thing would be to also move the right set of variables over.

The current syntax for semantic patches has got some limitations for its
expression power. I guess that it is still a software development challenge to
support also variations in involved statements.


> Its hard for me to think of how I can hint to Coccinelle enough information
> about what stuff it needs to move around. I think one hint would be:
>
> "Hey all that code that is static and is used *before* and *after* request_firmware()
> stuff it into the private data structure"

Do you need dynamic source code introspection here?

Regards,
Markus
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/