pwm: Use conftest to find if pwm_ops has config

Use conftest to determine if pwm_ops struct has config
callback or not. This call back is deprecated from
commit 0829c35dc534 ("pwm: Drop support for legacy drivers")
in Linux 6.0.

Bug 4387902

Change-Id: I83e0ad5edcb44ad9f84e7573287c338bd1137176
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3037919
Reviewed-by: Shardar Mohammed <smohammed@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
Laxman Dewangan
2023-12-19 08:24:14 +00:00
committed by mobile promotions
parent 702def895c
commit 1a45e366db
2 changed files with 4 additions and 6 deletions

View File

@@ -9,7 +9,6 @@
#include <linux/of_device.h>
#include <linux/pwm.h>
#include <linux/atomic.h>
#include <linux/version.h>
#include "cdi-pwm-priv.h"
@@ -33,7 +32,7 @@ static inline struct cdi_pwm_info *to_cdi_pwm_info(struct pwm_chip *chip)
return container_of(chip, struct cdi_pwm_info, chip);
}
#if KERNEL_VERSION(6, 0, 0) > LINUX_VERSION_CODE
#if defined(NV_PWM_OPS_STRUCT_HAS_CONFIG) /* Linux 6.0 */
static int cdi_pwm_enable(struct pwm_chip *chip, struct pwm_device *pwm)
{
struct cdi_pwm_info *info = to_cdi_pwm_info(chip);
@@ -127,7 +126,7 @@ static struct pwm_device *of_cdi_pwm_xlate(struct pwm_chip *pc,
}
static const struct pwm_ops cdi_pwm_ops = {
#if KERNEL_VERSION(6, 0, 0) > LINUX_VERSION_CODE
#if defined(NV_PWM_OPS_STRUCT_HAS_CONFIG) /* Linux 6.0 */
.config = cdi_pwm_config,
.enable = cdi_pwm_enable,
.disable = cdi_pwm_disable,

View File

@@ -9,7 +9,6 @@
#include <linux/of_device.h>
#include <linux/pwm.h>
#include <linux/atomic.h>
#include <linux/version.h>
#include "isc-pwm-priv.h"
@@ -33,7 +32,7 @@ static inline struct isc_pwm_info *to_isc_pwm_info(struct pwm_chip *chip)
return container_of(chip, struct isc_pwm_info, chip);
}
#if KERNEL_VERSION(6, 0, 0) > LINUX_VERSION_CODE
#if defined(NV_PWM_OPS_STRUCT_HAS_CONFIG) /* Linux 6.0 */
static int isc_pwm_enable(struct pwm_chip *chip, struct pwm_device *pwm)
{
struct isc_pwm_info *info = to_isc_pwm_info(chip);
@@ -127,7 +126,7 @@ static struct pwm_device *of_isc_pwm_xlate(struct pwm_chip *pc,
}
static const struct pwm_ops isc_pwm_ops = {
#if KERNEL_VERSION(6, 0, 0) > LINUX_VERSION_CODE
#if defined(NV_PWM_OPS_STRUCT_HAS_CONFIG) /* Linux 6.0 */
.config = isc_pwm_config,
.enable = isc_pwm_enable,
.disable = isc_pwm_disable,