Re: [PATCH v4] pwm: Fix compilation error when CONFIG_PWM is notdefined

From: Thierry Reding
Date: Tue Sep 18 2012 - 02:08:04 EST


On Wed, Sep 12, 2012 at 03:31:46PM +0530, Tushar Behera wrote:
> Add dummy implemention of public symbols for compilation-safe inclusion
> of include/linux/pwm.h file when CONFIG_PWM is not defined.
>
> Reported-by: Sachin Kamat <sachin.kamat@xxxxxxxxxx>
> Signed-off-by: Tushar Behera <tushar.behera@xxxxxxxxxx>
> ---
> Changes since v3:
> * Nitpicks
>
> Changes since v2:
> * #if condition for legacy functions modified
> * Reverted layout changes, can be taken up when HAVE_PWM is no longer
> required.
>
> Changes since v1:
> * Incorporated Thierry's suggestions regarding adding dummy function
> implemention for all global functions
> * Reorganized header file to have structure definitions first and then the
> function definitions.
>
> include/linux/pwm.h | 71 +++++++++++++++++++++++++++++++++++++++++++++++++-
> 1 files changed, 69 insertions(+), 2 deletions(-)

Okay, I've applied this to my for-next branch, with some minor changes.
For one I had to merge it with Alex's managed functions patch. Second I
changed all dummy functions that return a struct pwm_device * to return
ERR_PTR(-ENODEV) instead of NULL because PWM users typically check for
IS_ERR(pwm) and not for NULL.

Thierry

Attachment: pgp00000.pgp
Description: PGP signature