On 13 May 2014 15:51, Preeti U Murthy preeti@linux.vnet.ibm.com wrote:
On 05/13/2014 02:34 PM, Viresh Kumar wrote:
There is a requirement to add another mode: CLOCK_EVT_MODE_ONESHOT_STOPPED (lkml.org/lkml/2014/5/9/508) to clockevent devices and clockevent-drivers may or maynot support it. And so can return failure codes on a call to ->set_mode(), which has a return type of 'void' as of now.
To fix that, add another callback ->set_dev_mode(), with return type 'int'. All clockevent drivers will be migrated to use this new interface later. Also mark ->set_mode() deprecated.
In order to propagate error codes to callers of clockevents_set_mode(), its return type is also changed to 'int', but all the error handling is done inside clockevents_set_mode() currently as none of the currently available modes are allowed to fail.
Instead of *all the error handling*, you can perhaps say that we have added a WARN_ON() to begin with. We are ideally not doing any error handling other than a WARN_ON() right?
As suggested by you and Daniel (Over IRC), I have updated the logs. diff remains same:
Subject: [PATCH] clockevents: add ->set_dev_mode() to struct clock_event_device
There is a requirement to add another mode: CLOCK_EVT_MODE_ONESHOT_STOPPED (lkml.org/lkml/2014/5/9/508) to clockevent devices and clockevent-drivers may or maynot support it. Drivers that don't support it can return failure codes on a call to ->set_mode(), which has a return type of 'void' currently.
Following steps are suggested (by tglx) to get this fixed: 1. Add another callback ->set_dev_mode(), with return type 'int'. 2. Covert clockevent drivers to use ->set_dev_mode() instead of ->set_mode(). 3. Once all are converted, remove support for ->set_mode().
This patch implements 'part 1' of this approach. It also marks ->set_mode() deprecated as ->set_dev_mode() should be used instead.
In order to propagate error codes to callers of clockevents_set_mode(), change its return type to 'int'. Also add a WARN_ON() inside clockevents_set_mode() as none of the currently available modes are allowed to fail.