On Fri, 9 May 2014, Thomas Gleixner wrote:
> On Fri, 9 May 2014, Viresh Kumar wrote:
> So the right thing to do this is:
> 
> 1A) Change the prototype of the set_mode callback to return int and
>     fixup all users. Either add the missing default clause or remove
>     the existing BUG()/ pr_err()/whatever handling in the existing
>     default clause and return a UNIQUE error code.
> 
>     I know I should have done that from the very beginning, but in
>     hindsight one could have done everything better.
> 
>     coccinelle is your friend (if you need help ask me or Julia
>     Lawall). But it's going to be quite some manual work on top.

There is even a better way to do that:

1) Create a new callback set_state() which has an
   int return value.

2) Make the callsites do

   if (dev->set_state) {
      ret = dev->set_state();
      handle_return_value();
   } else
      dev->set_mode();

3) Convert implementations one by one to use the new callback

4) Remove the set_mode callback

5) Implement new features.

Thanks,

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

Reply via email to