On 4 June 2014 15:35, Preeti U Murthy preeti@linux.vnet.ibm.com wrote:
On 06/04/2014 02:58 PM, Viresh Kumar wrote:
On 4 June 2014 14:51, Preeti U Murthy preeti@linux.vnet.ibm.com wrote:
-static void decrementer_set_mode(enum clock_event_mode mode, +static int decrementer_set_mode(enum clock_event_mode mode, struct clock_event_device *dev) {
if (mode != CLOCK_EVT_MODE_ONESHOT)
int ret = 0;
switch (mode) {
default:
ret = -ENOSYS;
case CLOCK_EVT_MODE_UNUSED:
case CLOCK_EVT_MODE_SHUTDOWN:
case CLOCK_EVT_MODE_RESUME: decrementer_set_next_event(DECREMENTER_MAX, dev);
break;
case CLOCK_EVT_MODE_ONESHOT:
break;
}
return ret;
The ordering of the cases and the indentation got messed up here?
No, what looked awkward to you ?
In the above the default case comes first followed by the other cases. This will compile and run fine but this is not a conventional way of writing switch cases right?
decrementer_set_next_event(DECREMENTER_MAX, dev);
was required to be called for default case as well and so did it this way. Normally we keep default towards the end as it doesn't do anything, but for such cases we can have this implementation to get rid of code redundancy..
-- viresh