Replacing chunks of code with Macro-generated code?

Matthias Beyer mail at beyermatthias.de
Mon May 19 06:30:53 EDT 2014


Hi,

I'm currently doing some cleanup in drivers/staging/bcm. In the file

    drivers/staging/bcm/CmHost.c

there is a function (namingly DumpCmControlPacket()), which uses the
BCM_DEBUG_PRINT macro _a lot_. The first four parameters are the same
for _every_ usage of the macro, so there would be the possibility to
cover the usage of the BCM_DEBUG_PRINT macro with another macro which
sets the first parameters per default.

Something like

    BCM_DEBUG_ADAPTER_DUMP(str,args...) \
        do { BCM_DEBUG_PRINT(/*etc*/); } while(0)

would be possible. But is this good coding style in manner of kernel
style?

The current state is just WALL_OF_TEXT-like. If you scroll over the
file, there are 500 lines just macro after macro. So I guess it would
be worth cleaning it up.

What do you thing?

-- 
Mit freundlichen Grüßen,
Kind regards,
Matthias Beyer

Proudly sent with mutt.
Happily signed with gnupg.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
Url : http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20140519/1b617ccf/attachment.bin 


More information about the Kernelnewbies mailing list